13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

o If the file was opened with RESET and is not type INTERACTIVE, oneGET has already been executed; the first file record is in the buffervariable and the first GET retrieves the second record.o When an INTERACTIVE file is opened with RESET, no GET isperformed; the buffer variable is undefined and the first GET retrievesthe first record. This feature prevents an INTERACTIVE input, such asthe keyboard, from halting the program at a RESET procedure until acharacter is entered.o To PUT to the first file record in a non-INTERACTIVE file opened withRESET, you must use the SEEK procedure, described below. This isbecause opening with RESET automatically performs a GET, whichsequences the file to its second record.o You can return to the beginning of a file by reopening it with RESET.o When EOF is TRUE, the value of the buffer variable is undefined.Executing PUT causes an I/O error if there is no more room in the file;otherwise GET and PUT do not create If O errors.GET and PUT, when used with certain file types, translate certain controlcharacters into other characters. The rules are too complex to set forth here.You can find them under "Special Handling of Control Characters" inChapter 16.The SEEK ProcedureWhen Pascal accesses a typed file on a block-structured device (such as adisk), it numbers the file records in sequence, starting at 0. The SEEKprocedure sequences the file to a specific record number, forcing the nextGET or PUT procedure to access that specific.record. It looks like this:SEEK CFILEID, RECHUM>;where FILEID is the identifier of an open file, on a block-structured device,that is not a textfile. RECNUM is an integer from 0 to one less than thenumber of file records.Program Unit Required! The Program Unit PASCALIO must bepresent in an accessible library at the time any program using the SEEKprocedure is executed. P ASCALIO does not require a USES declaration,however. This Unit is originally supplied in the file SYSTEM.LIBRARY.For further information about libraries, see Chapter 13.Typed File 1/0 OperationsIII-171

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

Saved successfully!

Ooh no, something went wrong!