[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
FILE Declare Untyped File pp 114
Define: A file declared without a type using the reserved word file.
Purpose: Provides fast unformatted access to disk files in blocks of 128
bytes.
Notes: With untyped files, read and write operations to disk files are
transferred directly between the file and the variable, saving
the disk buffer space required by typed files. Untyped files
are compatible with all file types.
----------------------------------------------------------------------------
Usage:
CONST
BufSize : Integer = $1FF ; { $1FF blocks = 65408 bytes }
TYPE
BfrPtr = ^Byte ; { Buffer pointer is type Byte }
VAR
Buffer : BfrPtr ; { Buffer pointer }
FileVar : File ; { Untyped file }
Result : Integer ; { Number of 128 byte blocks read }
BEGIN
GetMem (Buffer,$FFFF) ; { Get $FFFF heap space for buffr }
Assign (FileVar,'D:TestData.') ; { Assign filename to handle }
Reset (FileVar) ; { Open handle for read }
Repeat { Load buffer until EOF }
BlockRead (FileVar,Buffer^,BufSize,Result);
Until Result = 0 ; { Read file until no more left }
Close (FileVar) ; { Close the file handle }
END.
See Also:
BlockRead
BlockWrite
File Of
Files
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson