[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
BlockRead procedure
DECLARATION: BlockRead(var F: File; var Buf; Count : Word
[; var Result : Word])
PURPOSE: Reads one or more records into a variable.
UNIT: System
REMARKS: F is an untyped file variable, Buf is any variable, count
is an expression of type word, and Result is a variable of
type word.
Reads Count or less records from the file F into
memory, starting at the first byte occupied by Buf.
The actual number of complete records read is returned in
the optional parameter Result. If Result is not specified,
an I/O error will occur if the number of records read is not
equal to Count.
The current file position is advanced by Result records.
RESTRICTIONS: File to be read must be open
EXAMPLE: Program CopyFile;
Var
InFile, OutFile : File;
QtyRead, QtyWritten : Word;
buf : Array[1..2048] of char;
Begin
Assign(InFile, "Input.fle");
ReSet(InFile, 1);
Assign(OutFile, "Output.fle");
ReWrite(OutFile, 1);
Repeat
BlockRead(InFile, buf, SizeOf(buf), QtyRead);
BlockWrite(OutFile, buf, QtyRead, QtyWritten);
Until (QtyRead = 0) or (QtyWritten <> QtyRead);
Close(InFile);
Close(OutFile);
End.
See Also:
BlockWrite
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson