Previous: 4.67.2.66. Randomize procedure To the Table of Contents Next: 4.67.2.68. ReadLn procedure
4.67.2.66. Randomize procedure Table of Contents 4.67.2.68. ReadLn procedure

- 4.67.2.67. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.67. Read procedure


4.67.2.67. 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: 4.67.2.66. Randomize procedure To the Table of Contents Next: 4.67.2.68. ReadLn procedure
4.67.2.66. Randomize procedure Table of Contents 4.67.2.68. ReadLn procedure

- 4.67.2.67. -