.TH ftp_open 3 "January 2004" "Feep Networks" "C Library Calls" .SH NAME ftp_write \- write to a file on an FTP server .SH SYNOPSIS .B #include .BI "ssize_t ftp_write(FTPFILE *" ftpfile ", char *" buf "," .BI "size_t " bufsize ");" .SH VERSION This man page documents version 1.3 of \fBlibfget\fP. .SH DESCRIPTION The \fBftp_write\fP() function writes \fIbufsize\fP bytes to the file associated with \fIftpfile\fP from the buffer pointed to by \fIbuf\fP. .SH RETURN VALUE The \fBftp_write\fP() function returns the number of characters written on success, or -1 on error (and sets \fIerrno\fP). .SH ERRORS The \fBftp_write\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 writing. .PP It may also fail for any of the errors specified for the underlying \fBpoll\fP(2) or \fBwrite\fP(2) system calls. .SH NOTES It is recommended that applications using \fBftp_write\fP() should ignore the \fISIGPIPE\fP signal. .SH SEE ALSO .BR libfget (3), .BR ftp_open (3), .BR write (2)