libssh2_sftp_open_ex.3 (2408B)
1.TH libssh2_sftp_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2" 2.SH NAME 3libssh2_sftp_open_ex - open filehandle for file on SFTP. 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7#include <libssh2_sftp.h> 8 9LIBSSH2_SFTP_HANDLE * 10libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename, 11 unsigned int filename_len, 12 unsigned long flags, 13 long mode, 14 int open_type); 15.fi 16.SH DESCRIPTION 17\fIsftp\fP - SFTP instance as returned by \fIlibssh2_sftp_init(3)\fP 18 19\fIfilename\fP - Remote file/directory resource to open 20 21\fIfilename_len\fP - Length of filename 22 23\fIflags\fP - Any reasonable combination of the LIBSSH2_FXF_* constants: 24.RS 25.IP LIBSSH2_FXF_READ 26Open the file for reading. 27.IP LIBSSH2_FXF_WRITE 28Open the file for writing. If both this and LIBSSH2_FXF_READ are specified, 29the file is opened for both reading and writing. 30.IP LIBSSH2_FXF_APPEND 31Force all writes to append data at the end of the file. 32.IP LIBSSH2_FXF_CREAT, 33If this flag is specified, then a new file will be created if one does not 34already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be 35truncated to zero length if it previously exists) 36.IP LIBSSH2_FXF_TRUNC 37Forces an existing file with the same name to be truncated to zero length when 38creating a file by specifying LIBSSH2_FXF_CREAT. LIBSSH2_FXF_CREAT MUST also 39be specified if this flag is used. 40.IP LIBSSH2_FXF_EXCL 41Causes the request to fail if the named file already exists. 42LIBSSH2_FXF_CREAT MUST also be specified if this flag is used. 43 44.RE 45\fImode\fP - POSIX file permissions to assign if the file is being newly 46created. See the LIBSSH2_SFTP_S_* convenience defines in <libssh2_sftp.h> 47 48\fIopen_type\fP - Either of LIBSSH2_SFTP_OPENFILE (to open a file) or 49LIBSSH2_SFTP_OPENDIR (to open a directory). 50.SH RETURN VALUE 51A pointer to the newly created LIBSSH2_SFTP_HANDLE instance or NULL on 52failure. 53.SH ERRORS 54\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. 55 56\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 57 58\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP - 59 60\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was 61received on the socket, or an SFTP operation caused an errorcode to be 62returned by the server. 63 64\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would 65block. 66.SH SEE ALSO 67.BR libssh2_sftp_close_handle(3)