Previous: Randomize procedure To the Table of Content Next: ReadLn procedure

- 4.62.2.67 -
Standard Units
System Unit
System Unit Procedures and Functions

Read procedure

Targets: MS-DOS, OS/2, Win32


System Unit

Read from a file into one or more variables.

Declaration:
procedure Read(F, var  V1[, V2,...,Vn] ); // For typed files
procedure Read([var  F: Text;] V1[, V2,...,Vn ]); // For text files
Remarks:
Depending on the type of the variable or variables passed, Read copies the contents of the file, from the current file pointer, into the variable and advances the pointer. If Read cannot match the type of the variable with the contents of the file, an I/O error occurs. End of line ( #13 ) as well as end of file ( #26 ) cause Read to terminate.

For integers, Read expects an integer number in string form. Tabs, blank spaces, or end of line markers before the number are all skipped. When encountered thereafter, Read terminates.

For real variables, Read expects a number in real format. Blanks, tabs or end of line markers preceding the real string are skipped. When encountered thereafter, Read stops.

With strings, Read reads up to either an end of line marker or an end of file marker. If the string read is longer than 255 characters, it is truncated. Read does not advance the file.

See also
User Defined Reader Procedure (__reader)


Previous: Randomize procedure To the Table of Content Next: ReadLn procedure
Randomize procedure Table of Content ReadLn procedure

- 4.62.2.67 -