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.

In these examples, NUMFILE is a new file type, each record of which is anarray of 100 integers. INFILE and OUTFILE are file variables of typeNUMFILE. CO DEFORM is a file whose records are type CHAR. Finally,FLOWDAT A is an untyped file variable. Its contents will be handled in512-byte blocks.Connecting file variables to external files is accomplished by the REWRITE,RESET, and CLOSE procedures described below under "General File I/OOperations." Note that it is possible to associate an external file with morethan one file variable, at the same or different times. For example, anexternal file originally created as the value of a typed file variable maysubsequently be accessed as the value of an untyped file variable, or a filevariable of another type. This feature provides maximum flexibility inhandling data. It is also one of the techniques for defeating strong typing,discussed further in Chapter 16.Predeclared FiiesApple Pascal has three predeclared file variables. They are all of typeINTERACTIVE, and they are automatically opened by RESET when Pascalbegins execution. Their identifiers areOUTPUT INPUT KEYBOARDOUTPUT is the name for output to the monitor screen. It is also the defaultdestination for the WRITE and WRITELN procedures (see below).INPUT is the name for input from the keyboard which is also echoed to themonitor screen. It is the default destination for the READ and READLNprocedures.KEYBOARD is like INPUT, but it is not echoed to the monitor screen.Whenever a program terminates, Apple Pascal automatically performs aCLOSE procedure on these three files.File VariablesIII-159

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

Saved successfully!

Ooh no, something went wrong!