Flexible NC programming
1.20 Read lines in the file (READ)
Job planning
140 Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
Result variable (call-by-reference parameter)
Variable array in which the read text is stored.
Type: STRING (max. length: 255)
<result>:
If fewer lines are specified in the
<number of lines> parameter than
the array size
[<n>,<m>] of the result variable, the remaining array
elements will not be modified.
Termination of a line by means of the control characters "LF" (Line
Feed) or "CR LF" (Carriage Return Line Feed) is not stored in the
result variable.
Read lines are cropped if the line is longer than the defined string
length. An error message is not output.
Note
Binary files cannot be read in. The "incorrect data type" error is output (return value of the
error variable = 4). The following types of file are not readable: _BIN, _EXE, _OBJ, _LIB,
_BOT, _TRC, _ACC, _CYC, _NCK.
Example
Program code Comment
N10 DEF INT ERROR ; Definition of error variables.
N20 DEF STRING[255] RESULT[5] ; Definition of result variables.
N30 READ(ERROR,"/_N_CST_DIR/_N_TESTFILE_MPF",1,5,RESULT) ; Filename with domain, file
identifier and path
specification.
N40 IF ERROR <>0 ; Error evaluation.
N50 MSG("ERROR"<<ERROR<<"ON READ COMMAND")
N60 M0
N70 ENDIF
...