Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> blockwrite hi speed write of untyped file pp 114</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BLOCKWRITE             Hi Speed Write of Untyped File                pp 114

 Syntax:  BlockWrite (FileVar,Var,Blocks,Result) ;

 Type:    Untyped File

 Form:    Procedure

 Purpose: High speed write of FileVar, which is an Untyped file.

          Var is any variable that holds the data to transfer.

          Blocks is an integer expression defining the number of
          128 byte blocks to be transferred from the variable to disk.

          Result is an optional parameter that returns the actual
          number of 128 byte records transferred.

          The transfer starts with the first byte occupied by the variable
          Var.   The file pointer is advanced by (Recs x 128) bytes.

          A file to be operated on by BlockWrite must first be prepared by
          ASSIGN, REWRITE, or RESET.  The standard functions EOF, FILEPOS,
          and FILESIZE function the same as with typed files.

          SEEK uses a component size of 128 bytes.


 ----------------------------------------------------------------------------


 Program  ScreenDump;
   Const
     Blocks     = 128                          ; { Write 128 blocks         }
     DestName   = 'D:B800.DMP'                 ; { Destination file name    }

   Var
     Dest       : File                         ; { Dest is untyped file     }
     Result     : Integer                      ; { Bytes read on last block }
     Buffer     : Array [0..$3FFF] of Byte       { 16383 bytes of buffer    }
                  Absolute $0B800:$0           ; { Absolute buffer address  }

   Begin
     Assign     (Dest, DestName)               ; { Assign name to handle    }
     ReWrite    (Dest)                         ; { Open and clear the data  }
     BlockWrite (Dest, Buffer, Blocks, Result) ; { Write buffer to file     }
     Close      (Dest)                         ; { Destination file         }
   End.

See Also: BlockRead File Files

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson