Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.
Next: Line/Delimited, Previous: Closing, Up: Input and Output [Contents][Index]
Sets the current position of fd_port to the integer offset. For a file port, offset is expressed as a number of bytes; for other types of ports, such as string ports, offset is an abstract representation of the position within the port’s data, not necessarily expressed as a number of bytes. offset is interpreted according to the value of whence.
One of the following variables should be supplied for whence:
Seek from the beginning of the file.
Seek from the current position.
Seek from the end of the file.
If fd_port is a file descriptor, the underlying system
call is lseek
. port may be a string port.
The value returned is the new position in fd_port. 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.
Next: Line/Delimited, Previous: Closing, Up: Input and Output [Contents][Index]