.TH ftp_lseek 3 "January 2004" "Feep Networks" "C Library Calls" .SH NAME ftp_lseek \- reposition read/write FTP file offset .SH SYNOPSIS .B #include .BI "off_t ftp_lseek(FTPFILE *" ftpfile ", off_t " offset "," .BI "int " whence ");" .SH VERSION This man page documents version 1.3 of \fBlibfget\fP. .SH DESCRIPTION The \fBftp_lseek\fP() function repositions the offset of \fIftpfile\fP to the specified \fIoffset\fP. The interpretation of \fIoffset\fP is controlled by the directive \fIwhence\fP, which may be one of the following values: .IP \fBSEEK_SET\fP The offset is set to \fIoffset\fP bytes. .IP \fBSEEK_CUR\fP The offset is set to its current location plus \fIoffset\fP bytes. .SH RETURN VALUE The \fBftp_lseek\fP() function returns the resulting offset location as measured in bytes from the beginning of the file on success, or -1 on error (and sets \fIerrno\fP). .SH ERRORS The \fBftp_lseek\fP() function fails if: .TP .B ECONNRESET The server shut down the connection. The caller is then responsible for calling \fBftp_quit\fP() with the \fBFTP_QUIT_FAST\fP flag set. .TP .B ETIMEDOUT The operation timed out. (The timeout interval can be set via the \fBFTP_OPT_IO_TIMEOUT\fP option; see the \fBftp_set_options\fP(3) man page for details.) .TP .B EINVAL Unexpected response code received from server. .TP .B EINVAL The \fIwhence\fP directive was set to an invalid value. .TP .B ENOSYS The \fIwhence\fP directive was set to \fBSEEK_END\fP, which is not currently supported. .TP .B ENOSYS The file pointer \fIFTPFILE\fP was opened in \fBO_WRONLY\fP mode. The \fBftp_lseek\fP() function only supports \fBO_RDONLY\fP files. .PP It may also fail for any of the errors specified for the underlying \fBpoll\fP(2), \fBread\fP(2), \fBwrite\fP(2), \fBsend\fP(2), \fBsocket\fP(2), \fBconnect\fP(2), \fBfcntl\fP(2) (using \fBF_GETFL\fP and \fBF_SETFL\fP), or \fBcalloc\fP(3) system and library calls. .SH NOTES The \fBftp_lseek\fP() function cannot be used if \fIftpfile\fP was created with \fImode\fP set to \fBO_WRONLY\fP. As a consequence of this, it does not support the \fBSEEK_END\fP directive. Unlike \fBlseek\fP(2), \fBftp_lseek\fP() does not allow seeking past the end of a file. .SH SEE ALSO .BR libfget (3), .BR lseek (2)