[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
BLOCKREAD Hi Speed Read of Untyped File pp 114
Syntax: BlockRead (FileVar,Var,Blocks,Result) ;
Type: Untyped File
Form: Procedure
Purpose: High speed read 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.
The programmer must insure that the variable, Var, occupies
enough space to accomodate the entire data transfer.
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 FileCopy ; { Expanded for clarity }
Const
Blocks = 128 ; { 128 blocks }
BufSize = 128 ; { 128 byte buffer }
SourceName = 'INPUT.FIL' ; { Source }
DestName = 'OUTPUT.FIL' ; { Destination }
Var
Source : File ; { Untyped file }
Dest : File ; { Untyped file }
Buffer : Array[1..Blocks, 1..BufSize] Of Byte ;
RecsRead : Integer ;
Begin
Assign (Source, SourceName) ; { Name to handle }
Reset (Source) ; { Open for R/W }
Assign (Dest, DestName) ; { Name to handle }
ReWrite(Dest) ; { Open and clear }
Repeat
BlockRead (Source, Buffer, BufSize, RecsRead) ; { Source to bfr }
BlockWrite (Dest, Buffer, RecsRead) ; { Bfr to Dest }
Until RecsRead = 0 ; { Empty the bfr }
Close (Source) ;
Close (Dest) ;
End.
See Also:
BlockWrite
File
Files
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson