ftp_lseek(3) C Library Calls ftp_lseek(3)NAMEftp_lseek - reposition read/write FTP file offset
SYNOPSIS
#include <libfget.h>
off_t ftp_lseek(FTPFILE *ftpfile, off_t offset, int whence);
VERSION
This man page documents version 1.3 of libfget.
DESCRIPTION
The ftp_lseek() function repositions the offset of ftpfile to the spec‐
ified offset. The interpretation of offset is controlled by the direc‐
tive whence, which may be one of the following values:
SEEK_SET
The offset is set to offset bytes.
SEEK_CUR
The offset is set to its current location plus offset bytes.
RETURN VALUE
The ftp_lseek() function returns the resulting offset location as mea‐
sured in bytes from the beginning of the file on success, or -1 on
error (and sets errno).
ERRORS
The ftp_lseek() function fails if:
ECONNRESET
The server shut down the connection. The caller is then respon‐
sible for calling ftp_quit() with the FTP_QUIT_FAST flag set.
ETIMEDOUT
The operation timed out. (The timeout interval can be set via
the FTP_OPT_IO_TIMEOUT option; see the ftp_set_options(3) man
page for details.)
EINVAL Unexpected response code received from server.
EINVAL The whence directive was set to an invalid value.
ENOSYS The whence directive was set to SEEK_END, which is not currently
supported.
ENOSYS The file pointer FTPFILE was opened in O_WRONLY mode. The
ftp_lseek() function only supports O_RDONLY files.
It may also fail for any of the errors specified for the underlying
poll(2), read(2), write(2), send(2), socket(2), connect(2), fcntl(2)
(using F_GETFL and F_SETFL), or calloc(3) system and library calls.
NOTES
The ftp_lseek() function cannot be used if ftpfile was created with
mode set to O_WRONLY. As a consequence of this, it does not support
the SEEK_END directive.
Unlike lseek(2), ftp_lseek() does not allow seeking past the end of a
file.
SEE ALSOlibfget(3), lseek(2)Feep Networks January 2004 ftp_lseek(3)