|
Untyped Files |
Top Previous Next |
|
What is translated > File Input and Output > Untyped Files The Delphi type File is translated to UntypedFile.
The name UntypedFile is used to avoid a conflict with System.IO.File.
// Renamed from File to UntypedFile to avoid conflicts with System.IO.File. UntypedFile myFile = UntypedFile.CreateRecord();
Untyped files are accessed in blocks.
The record size is specified when the file is opened:
AssignFile(myFile, "Data.bin"); Rewrite(myFile, 1);
If no record size is specified, the Delphi default record size is 128 bytes.
A record size of one means that the record count is also the byte count.
Data is written with BlockWrite:
int recordsWritten;
BlockWrite( myFile, buffer, buffer.Length, out recordsWritten);
Data is read with BlockRead:
int recordsRead;
BlockRead( myFile, buffer, buffer.Length, out recordsRead);
UntypedFile is derived from TFileRec. TypedFile<T> also uses TFileRec as its binary file base implementation.
|
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |