CFile:FilePos


The FilePos method returns the byte offset of the file read/write pointer.

Syntax

nPos = CFile:FilePos()

where

    nPos is the byte offset of the current file position. On success, a number >= 0 is returned. On failure, -1 is returned.

  

The value returned by FilePos is a byte offset from the beginning of the file as seen by the operating system. If the file is translated to text mode when written to the file, then this value differs from the actual byte offset in the file.

Example

Suppose a CFile F exists and that the file is empty. The following script writes a string to it and then returns the file position after the write operation:

F:Printf( "a string" )

 

Printf("pos = %d", F:FilePos() )

-- result: pos = 8

Related Topics

Seek

CFile:Printf

CFile class