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_TEST-
FILE_MPF",1,5,RESULT)
;File name with domain and file iden-
tifier
and path name.
N40 IF ERROR <>0 ;Error evaluation.
N50 MSG("ERROR"<<ERROR<<"ON READ COMMAND")
N60 M0
N70 ENDIF
...
3.5.4 Check for presence of file (ISFILE)
The ISFILEcommand checks whether a file exists in the program memory.
Syntax
<Result>=ISFILE("<File name>")
Meaning
ISFILE: Command to check the availability of a file
<file name>: Name of the file whose availability is to be checked.
Type: STRING
The absolute path can be specified before the actual file name. If a path is not
specified, the file is searched for in the current directory (= directory of selected
program).
Rules regarding path data, see "Addressing program memory files (Page 554)".
<result>: Result variable to which the result of the check is assigned.
Type. BOOL
Value: TRUE File exists
FALSE File does not exist
Work preparation
3.5 File handling
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0 571