DEF file_io_test( )
DECL INT handle
DECL STATE_T stat
DECL CHAR line[256]
; --- Write test file ---
COPEN(handle, "D:/test.txt", "w")
IF handle > 0 THEN
CWRITE(handle, stat, "%s", "1914.495 -14.041 0.300 180.0 0.0 180.0\n")
CWRITE(handle, stat, "%s", "1911.997 -18.265 0.300 180.0 0.0 180.0\n")
CWRITE(handle, stat, "%s", "1909.056 -22.432 0.300 180.0 0.0 180.0\n")
CCLOSE(handle)
MsgNotify("Write OK, handle=" << handle)
ELSE
MsgNotify("Open write FAILED, handle=" << handle)
RETURN
ENDIF
; --- Read test file ---
COPEN(handle, "D:/test.txt", "r")
IF handle > 0 THEN
CREAD(handle, stat, "%s", line)
MsgNotify("Read OK: " << line)
CCLOSE(handle)
ELSE
MsgNotify("Open read FAILED, handle=" << handle)
ENDIF
END