hi PnsStarter,
that's for the reply.
OK, it was not working because i was using roboguide. sim gives 2014 for everything - duh!
on the real robot, the correct status's are set.
but....
OPEN FILE LOG_FILE('AP', fn)
fstatus = IO_STATUS(LOG_FILE)
fstatus is always zero whether USB plugged in or not on sim and robot.
No-one at our Fanuc contacts know why.
OPEN FILE LOG_FILE('RO', fn)
however, does give the correct status though. so this was used in the end (if anyone's insterested)..
OPEN FILE LOG_FILE('RO',fn)
fstatus = IO_STATUS(LOG_FILE)
IF (fstatus = 0) OR (fstatus = 2014) THEN;
IF (fstatus = 0) THEN;
-- log file exists..
ENDIF
IF (fstatus = 2014) THEN;
-- log file doesn’t exists..
ENDIF
CLOSE FILE LOG_FILE
OPEN FILE LOG_FILE('AP',fn)
fstatus = IO_STATUS(LOG_FILE)
IF fstatus = 0 THEN
-- write log file..
ENDIF
ELSE
IF (fstatus = 2068) THEN;
-- usb not plugged in..
ENDIF
ENDIF
CLOSE FILE LOG_FILE
Cheers,
Chris