Sets the current position of fd/port to the integer offset, which is interpreted according to the value of whence.
One of the following variables should be supplied for whence:
If fd/port is a file descriptor, the underlying system call islseek
. port may be a string port.The value returned is the new position in the file. This means that the current position of a port can be obtained using:
(seek port 0 SEEK_CUR)
Return an integer representing the current position of fd/port, measured from the beginning. Equivalent to:
(seek port 0 SEEK_CUR)
Truncate file to length bytes. file can be a filename string, a port object, or an integer file descriptor. The return value is unspecified.
For a port or file descriptor length can be omitted, in which case the file is truncated at the current position (per
ftell
above).On most systems a file can be extended by giving a length greater than the current size, but this is not mandatory in the POSIX standard.