Scieneer Common Lisp 1.3.9 online documentation

file-position stream &optional position[Function]

When the position is nil, returns the current position within the stream or nil if the position can not be determined. When a position is given it becomes the new file position, returning t if the position is successfully changed otherwise returning nil. The second argument may also be :start or :end for the start or end of the file, respectively.

The position is measured in units of bytes for binary streams and in units of characters for character streams, and is defined as the number of bytes or characters returned by read-byte or read-char when reading from the start of the file to the current position. The position may not be the same as the position in the underlying file due to non-unity encoding. For example: character encoding streams, compressed binary streams, end-of-line conversion streams, etc.

For each byte or character written the position change will typically be one but in general may be more or less than one. For example: an indenting output stream can insert characters at the start of each line resulting in a multi-character change in position; or a character conversion output stream may ignore and drop characters that can not be encoded. Buffered output is written and finished before calculating or changing the position so that the change in position is noted and so that the output is written to the correct position.

See also: file-position, file-length, and ext:stream-file-position.