8.2.14 File types

File types are represented as records. Typed les and untyped les are represented as a xed record:

  filerec = packed record  
    handle    : longint;  
    mode      : longint;  
    recsize   : longint;  
    _private  : array[1..32] of byte;  
    userdata  : array[1..16] of byte;  
    name      : array[0..255] of char;  
  End;

Text les are described using the following record:

  TextBuf = array[0..255] of char;  
  textrec = packed record  
    handle    : longint;  
    mode      : longint;  
    bufsize   : longint;  
    _private  : longint;  
    bufpos    : longint;  
    bufend    : longint;  
    bufptr    : ^textbuf;  
    openfunc  : pointer;  
    inoutfunc : pointer;  
    flushfunc : pointer;  
    closefunc : pointer;  
    userdata  : array[1..16] of byte;  
    name      : array[0..255] of char;  
    buffer    : textbuf;  
  End;

handle
The handle eld returns the le handle (if the le is opened), as returned by the operating system.
mode
The mode eld can take one of several values. When it is fmclosed, then the le is closed, and the handle eld is invalid. When the value is equal to fminput, it indicates that the le is opened for read only access. fmoutput indicates write only access, and the fminout indicates read-write access to the le.
name
The name eld is a null terminated character string representing the name of the le.
userdata
The userdata eld is never used by Free Pascal, and can be used for special purposes by software developpers.