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