[Data] don't work with While Not Eof(filein) wend
Blitz3D Forums/Blitz3D Beginners Area/[Data] don't work with While Not Eof(filein) wend
| ||
H! Here is a little code with-out some function's like readfile etc. Restore startData While Not Eof(filein) testthis() Wend Function testthis() For i = 0 To 9 Read a% Read b% Read c% Print b% Next End Function .startData Data 0,0,0 Data 0,1,1 Data 0,2,2 Data 0,3,3 Data 0,4,4 Data 0,5,5 Data 0,6,6 Data 0,7,7 Data 0,8,8 Data 0,9,9 -------------------------------------------- The code above gives this error : Out of data The code below not Restore startData testthis() Function testthis() For i = 0 To 9 Read a% Read b% Read c% Print b% Next End Function .startData Data 0,0,0 Data 0,1,1 Data 0,2,2 Data 0,3,3 Data 0,4,4 Data 0,5,5 Data 0,6,6 Data 0,7,7 Data 0,8,8 Data 0,9,9 -------------------------------------------- but what I want is the first code ;read a file While Not Eof(filein) ;read a line ; do something with the data testthis() Wend I know that this sound weird but is there a way to do this with the first code ? Thanks |
| ||
The reason you are getting an "out of data" error is because the data is only restored once - BEFORE the loop begins. Move the restore command inside the loop. That should solve your problems. |
| ||
Thanks , :) its working now |