Logo Search packages:      
Sourcecode: calibre version File versions  Download package

int(* mspack_system::seek)(struct mspack_file *file, off_t offset, int mode)

Seeks to a specific file offset within an open file.

Sometimes the library needs to know the length of a file. It does this by seeking to the end of the file with seek(file, 0, MSPACK_SYS_SEEK_END), then calling tell(). Implementations may want to make a special case for this.

Due to the potentially varying 32/64 bit datatype off_t on some architectures, the MSPACK_SYS_SELFTEST macro MUST be used before using the library. If not, the error caused by the library passing an inappropriate stackframe to seek() is subtle and hard to trace.

file the file to be seeked
offset an offset to seek, measured in bytes
mode one of MSPACK_SYS_SEEK_START (the offset should be measured from the start of the file), MSPACK_SYS_SEEK_CUR (the offset should be measured from the current file offset) or MSPACK_SYS_SEEK_END (the offset should be measured from the end of the file)
zero for success, non-zero for an error
See also:
open(), tell()

Generated by  Doxygen 1.6.0   Back to index