.TH ftp_read 3 "January 2004" "Feep Networks" "C Library Calls" .SH NAME ftp_read \- read from a file on an FTP server .SH SYNOPSIS .B #include .BI "ssize_t ftp_read(FTPFILE *" ftpfile ", char *" buf "," .BI "size_t " bufsize ");" .SH VERSION This man page documents version 1.3 of \fBlibfget\fP. .SH DESCRIPTION The \fBftp_read\fP() function reads at most \fIbufsize\fP bytes from the file associated with \fIftpfile\fP and stores them in the buffer pointed to by \fIbuf\fP. .SH RETURN VALUE The \fBftp_read\fP() function returns the number of characters read on success, or -1 on error (and sets \fIerrno\fP). .SH ERRORS The \fBftp_read\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 EBADF \fIftpfile\fP was not opened for reading. .PP It may also fail for any of the errors specified for the underlying \fBpoll\fP(2) or \fBread\fP(2) system calls. .RE .SH SEE ALSO .BR libfget (3), .BR ftp_open (3), .BR read (2)