seek

LUA

seek

seek (FILEHANDLE [,WHENCE] [,OFFSET])

Sets and gets the flle position (bytes), to the position given by OFFSET from a base specifled by the stringWHENCE, as follows:

  • set
  • base is position 0 (beginning of the flle)
  • cur
  • base is current position end base is end of flle If successful
  • seek
  • returns the flnal flle position,measured in bytes from the beginning of the flle.

On error, it returns nil , plus a string describing the error.Default for WHENCE is cur; for OFFSET is 0.

seek(file) returns the current flle position, without changing it.

seek(file, "set") sets the position to the beginning (returns 0.)

seek(file, "end") sets the position to the end (returns its size.)