1libssh2_sftp_open_ex(3) libssh2 manual libssh2_sftp_open_ex(3)
2
3
4
6 libssh2_sftp_open - open filehandle for file on SFTP.
7
9 #include <libssh2.h>
10 #include <libssh2_sftp.h>
11
12 LIBSSH2_SFTP_HANDLE *
13 libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename,
14 unsigned int filename_len, unsigned long flags,
15 long mode, int open_type);
16
18 sftp - SFTP instance as returned by libssh2_sftp_init(3)
19
20 filename - Remote file/directory resource to open
21
22 filename_len - Length of filename
23
24 flags - Any reasonable combination of the LIBSSH2_FXF_* constants:
25
26 LIBSSH2_FXF_READ
27 Open the file for reading.
28
29 LIBSSH2_FXF_WRITE
30 Open the file for writing. If both this and LIB‐
31 SSH2_FXF_READ are specified, the file is opened for both
32 reading and writing.
33
34 LIBSSH2_FXF_APPEND
35 Force all writes to append data at the end of the file.
36
37 LIBSSH2_FXF_CREAT,
38 If this flag is specified, then a new file will be cre‐
39 ated if one does not already exist (if LIBSSH2_FXF_TRUNC
40 is specified, the new file will be truncated to zero
41 length if it previously exists)
42
43 LIBSSH2_FXF_TRUNC
44 Forces an existing file with the same name to be trun‐
45 cated to zero length when creating a file by specifying
46 LIBSSH2_FXF_CREAT. LIBSSH2_FXF_CREAT MUST also be speci‐
47 fied if this flag is used.
48
49 LIBSSH2_FXF_EXCL
50 Causes the request to fail if the named file already
51 exists. LIBSSH2_FXF_CREAT MUST also be specified if this
52 flag is used.
53
54 mode - POSIX file permissions to assign if the file is being newly cre‐
55 ated. See the LIBSSH2_SFTP_S_* convenience defines in <libssh2_sftp.h>
56
57 open_type - Either of LIBSSH2_SFTP_OPENFILE (to open a file) or LIB‐
58 SSH2_SFTP_OPENDIR (to open a directory).
59
61 A pointer to the newly created LIBSSH2_SFTP_HANDLE instance or NULL on
62 failure.
63
65 LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
66
67 LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
68
69 LIBSSH2_ERROR_SOCKET_TIMEOUT -
70
71 LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was
72 received on the socket, or an SFTP operation caused an errorcode to be
73 returned by the server.
74
75 LIBSSH2_ERROR_EAGAIN - Marked for non-blocking I/O but the call would
76 block.
77
79 libssh2_sftp_close_handle(3)
80
81
82
83
84libssh2 0.15 1 Jun 2007 libssh2_sftp_open_ex(3)