I've taken on learning the CWRITE, etc. Its actually not going terribly, and I think I may be able to make use of this...
Here is my stab at a program
DEF dataImport ( )
INT FileHandle, i, length
BOOL EOF
DECL STATE_T State
DECL MODUS_T MODE
DECL SEEK_MODE_T SEEK
MODE =#SYNC
SEEK = #SEEK_CUR
EOF=FALSE
FileHandle = 0, length = 0
i = 1
CWRITE($FCT_CALL, State, MODE, "krl_fopen", "frametest2.txt", "r", FileHandle)
CWRITE($FCT_CALL, State, MODE, "krl_fsizeget", FileHandle, length)
WHILE EOF==FALSE
Remote[i] = $WORLD
Remote[i].E1 = 0,Remote[i].E2 = 0,Remote[i].E3 = 0,Remote[i].E4 = 0
CWRITE($FCT_CALL, State, MODE, "krl_fscanf", FileHandle, "%f,%f,%f,%f,%f,%f", Remote[i].X,Remote[i].Y,Remote[i].Z,Remote[i].A,Remote[i].B,Remote[i].C)
CWRITE($FCT_CALL, State, MODE, "krl_fscanf", FileHandle, "%f,%f,%f,%f", Remote[i].E1,Remote[i].E2,Remote[i].E3,Remote[i].E4)
CWRITE($FCT_CALL, State, MODE, "krl_feof", FileHandle, EOF)
i = i + 1
ENDWHILE
CWRITE($FCT_CALL, State, MODE, "krl_fclose", FileHandle)
END
So the above code sort of works fine, but I never hit EOF if I have more than one line in the file. Is it looking for something else to advance the pointer? FYI, Remote is a global array of E6POS. It seems CWRITE requires the return variables to already be initialized.
My file is just :
0,1000,2000,3000,4000,5000,0,1,2,3
0,1001,2001,3001,4001,5001,0,1,2,3
0,1000,2000,3000,4000,5000,0,1,2,3
0,1000,2000,3000,4000,5000,0,1,2,3
It reads the first line and then nothing after that(but it keeps looping). I thought maybe I could advance the file pointer with fseek, but its not clear where I should move it to. The krl_fsizeget of the file returns 142 byte.
Is there a more streamlined way to do this?