The Open function The Open function is called by the Reset, Rewrite, and Append standard procedures to open a text file associated
with a device. On entry, the Mode field contains fmInput, fmOutput, or fmInOut to indicate whether the Open function
was called from Reset, Rewrite, or Append.
The Open function prepares the file for input or output, according to the Mode value. If Mode specified fmInOut
(indicating that Open was called from Append), it must be changed to fmOutput before Open returns.
Open is always called before any of the other device-interface functions. For that reason, AssignDev only initializes
the OpenFunc field, leaving initialization of the remaining vectors up to Open. Based on Mode, Open can then install
pointers to either input- or output-oriented functions. This saves the InOut, Flush functions and the CloseFile
procedure from determining the current mode.