3.3.4 File types

File types are types that store a sequence of some base type, which can be any type except another le type. It can contain (in principle) an innite number of elements. File types are used commonly to store data on disk. However, nothing prevents the programmer, from writing a le driver that stores its data for instance in memory.

Here is the type declaration for a le type:

_________________________________________________________________________________________________________File types
-- --  le type -  le---------------------------------------------------
                  -of- type--|
___________________________________________________________________

If no type identier is given, then the le is an untyped le; it can be considered as equivalent to a le of bytes. Untyped les require special commands to act on them (see Blockread, Blockwrite). The following declaration declares a le of records:

Type  
  Point = Record  
    X,Y,Z : real;  
    end;  
  PointFile = File of Point;

Internally, les are represented by the FileRec record, which is declared in the Dos or SysUtils units.

A special le type is the Text le type, represented by the TextRec record. A le of type Text uses special input-output routines. The default Input, Output and StdErr le types are dened in the system unit: they are all of type Text, and are opened by the system unit initialization code.