Sorry BlackD, I was misunderstanding what you meant :)
Ok, try this code instead:
In your first example the '+4' isn't necessary, as this would write 4 bytes (0-3) then you were jumping 4 bytes on top of the current file position which is now 3. So in effect you were writing 4 bytes (0-3) then missing 4 bytes (4-7) then writing 4 bytes (8-11) and so on...
Also, the 'SeekFile fileout,0' isn't necessary as the file position will already be set to zero when you open the file with OpenFile.
The SeekFile *MUST* be before the WriteInt to work correctly, I'm not sure why, maybe something to do with checking the EOF after using the SeekFile command?
I'm not sure what the maximum file size this code will work on though, you need to test it and see, but it does work.
Ok, try this code instead:
timer=MilliSecs() fileout=OpenFile("test.txt") Print "opened!" While Not Eof(fileout) SeekFile fileout,FilePos(fileout) WriteInt fileout,0 Wend CloseFile fileout timeelapsed=MilliSecs()-timer Print timeelapsed/1000 Print "done!" Delay 200 End
In your first example the '+4' isn't necessary, as this would write 4 bytes (0-3) then you were jumping 4 bytes on top of the current file position which is now 3. So in effect you were writing 4 bytes (0-3) then missing 4 bytes (4-7) then writing 4 bytes (8-11) and so on...
Also, the 'SeekFile fileout,0' isn't necessary as the file position will already be set to zero when you open the file with OpenFile.
The SeekFile *MUST* be before the WriteInt to work correctly, I'm not sure why, maybe something to do with checking the EOF after using the SeekFile command?
I'm not sure what the maximum file size this code will work on though, you need to test it and see, but it does work.