Fread, Fread, fr, Read, fr – Visara Master Console Center Scripting Guide User Manual
Page 117: Fread, frenam, Ead, fren
Chapter 5 Script Commands
Scripting Guide
117
FREAD
Syntax:
FREAD( %FileNum, var1[, var2, ..., [varn]...]) ==> %QtyRead
Description:
Reads values from an open file into variables.
Action:
Each value from the file is read into its respective positional variable in
the parameter list.
Parameters:
%FileNum. Numeric expression. The file handle obtained from
FOPEN(). The file to read data from.
Var. Numeric or string variables. The variables to place the values
from the file into. The number of variables is unlimited.
Returns:
Numeric value, as follows:
Value
Meaning
0
All values have been read from the file
(at EOF) or a read error occurred.
Any other value
The number of values read from the file.
Notes:
1. The file handle obtained from an FOPEN() call is only valid in the
same script that contains the FOPEN().
2. FREAD() has the same file format expectations as FWRITE()
creates—the contents of one variable parameter will be all
characters in a file from a starting position up to the next newline
character (each newline character is discarded after reading). For
example, if a file contains 1000 characters without a newline
character, the first FREAD() variable parameter receives all of the
1000 characters from the file, and any other variable parameters
receives no characters.
3. If a value in the file is numeric and is to be placed in a string
variable in an FREAD() parameter, the value is automatically
converted to a string.
4. If a value in the file is a character and is to be placed in a numeric
variable in an FREAD() parameter, the value is automatically
converted following the rules for the VAL() command.
5. The return value will never be larger than the quantity of variable
parameters to read into provided.
Example:
%Handle := FOPEN( $FileName)
FREAD( %Handle, %ShutdownClean, $IPLInfo)
See Also:
FCLOSE, FEXISTS, FOPEN, FRENAME, FREWIND, FWRITE