int FileCurrentPos(int file)
Pass a file handle opened in either read or write mode, and it returns the number of preceding bytes to the current position. As all read/write functions automatically increment the position, this is will generally return the number of the next byte to be read/written.
int file = FileOpen("dump.dat", FILE_WRITE); Log("Start: "+str(FileCurrentPos(file))); FileWriteQuad(file, 97); Log("After Quad: "+str(FileCurrentPos(file))); FileWriteString(file, "Four"); Log("After String: "+str(FileCurrentPos(file))); FileClose(file); // Creates/overwrites a new file and writes some data // Logging the position after each step, like so: // "Start: 0" // "After Quad: 4" // "After String: 10" // Position starts at 0 // After writing a quad byte position is 4 // After writing a string of length 4, with 2 byte header // Incrememnts another 6, for a total position of 10
There are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
Your docs |