Previous: , Up: File Objects   [Contents][Index]


5.26.2.3 Functions on File Objects

Function: seek-file file #!optional offset where

When called as (seek-file file), returns the distance in bytes from the start of the file that the next character would be read from.

When called as (seek-file file offset [where]) alters the position from which the next byte will be read. where can be one of the values:

()

offset bytes after the current position.

start

offset bytes after the beginning of the file.

end

offset bytes before the end of the file.

Note that not all files may be seekable; if (seek-file file) returns false, indicating that the current position is unknown, any attempts to set the current position will also fail.

Function: flush-file file

This function flushes any buffered output to the file object file to disk.

Function: file-binding file

Returns the name of the file which the file object file is currently bound to. Returns false if the file is currently unbound (i.e. close-file was called on it).

The next three functions are used when non-local files are being accessed. See File Handlers for more details.

Function: file-bound-stream file

If the file object file doesn’t refer to a file in the local filing system, return the stream that it is bound to (allowing the file’s contents to be accessed), this may or may not be another file object.

Function: file-handler-data file

Return the file-handler-specific data associated with the file object file.

Function: set-file-handler-data file data

Set the handler-specific data of file object file to data. This should only be done by the handler owning the file.

It’s also possible to register a callback function to be invoked when input is available on a file,

Function: set-input-handler local-file function

Arrange for function to be called whenever pending input is available on local-file, a file object bound to a file in the local file space.

Note that this makes local-file subsequently do non-blocking input.

This function is normally only useful when local-file represents a pipe or socket.


Previous: , Up: File Objects   [Contents][Index]