13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Where this table indicates a disk file is kept, all its contents remain on thedisk and its file name remains in the disk directory. Where it indicates a fileis trunc, it is kept but truncated; all of the file after the most recentlyaccessed file record is thrown away. Where it indicates a file is deleted, itdisappears as if it had never been created. Its filename is removed from thedisk directory.Here are two examples of CLOSE commands:CLOSE CFILEID>;CLOSE CFILEID, LOCK>;These rules apply to using the CLOSE procedure:{NORMAL clo5e}{file clo5ed and LOCKed}o If you terminate your program with any files still open, Pascal willautomatically perform a NORMAL close on them.o If an external file is associated with more than one file variable, closing itwith one closes it for all.o Using CLOSE on an already-closed file has no effect.The EOF FunctionEOF retums a boolean value that indicates whether the end of a specifiedfile has been reached. It is written this way:l~ I(\ J file l___t)\ • •~~ .,V! identifier ~ JThe optional file identifier is the name of a declared file variable. If it isomitted, the predeclared file INPUT is assumed.Here is a typical use of EOF to control an IF ... THEN statement:IF EDF CFILEID> THEN --The following rules govern the use of the EOF function:o You may combine EOF with other functions and operators to formboolean expressions.o EOF is TRUE for every closed file.o Whenever EOF is TRUE, the file's buffer variable is undefined.o If an external file is associated with more than one file variable, EOFalways has the same value for all of them.General File 1/0 OperationsIII-167

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!