OPENF - open file for use by Pascal program.

Usage:

type string = packed array[m..n] of char;
var
    f : file of ...;
    filename : string;
    mode : char;
...
openf(f, filename, mode);
...
read(f, ...);
...
closef(f);

Description:

OPENF initiates activity on a file and attaches the Pascal file variable "f" to the file named by "filename". The mode character is one of 'r', 'w', or 'a', for read, write, or append access. Thereafter, references to variable "f" by the Pascal I/O procedures (e.g. GET, PUT, READ, WRITE) will cause I/O from or to "filename". If the file is opened for output and does not exist, it will be created. (A permanent file is created if the name contains a '/' or '$', and otherwise a temporary file is created.) If the file cannot be opened, an error message is printed and execution is terminated.

Note that 'a' (append) access means just that -- data is appended to the existing contents of the file.

OPENF causes a RESET (or REWRITE) to be performed on the file variable "f" so that it is rewound and ready for use.

The pre-declared textfiles "input", and "output" may not be used as the file arguments to OPENF.

OPENF is a predeclared function, known to the compiler. It may not be passed as an argument. Because it is special to the compiler, an attempt to declare it "extern" will not work.

Copyright © 1996, Thinkage Ltd.