[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
BlockWrite procedure
DECLARATION: BlockWrite(var F : File; var Buf; Count : Word
[; var Result : Word])
PURPOSE: Writes one or more records from 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.
Writes Count or less records to the file F from
memory, starting at the first byte occupied by Buf.
The actual number of complete records written is returned in
the optional parameter Result. If Result is not specified,
an I/O error will occur if the number of records written is
not equal to Count.
The current file position is advanced by Result records.
RESTRICTIONS: File to be written must be open
EXAMPLE: program copyfile;
Var
InFile, OutFile : File;
QtyRead, QtyWritten : Word;
buf : Array[1..2048] of Char;
Begin
Assign(InFile, "Input.fle"); { Literal filename 'input.fle' }
ReSet(InFile, 1);
Assign(OutFile, "Output.fle"); { Literal filename '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:
BlockRead
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson