1libssh2_sftp_open_ex(3)             libssh2            libssh2_sftp_open_ex(3)
2
3
4

NAME

6       libssh2_sftp_open_ex - open filehandle for file on SFTP.
7

SYNOPSIS

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,
15                            unsigned long flags,
16                            long mode,
17                            int open_type);
18

DESCRIPTION

20       sftp - SFTP instance as returned by libssh2_sftp_init(3)
21
22       filename - Remote file/directory resource to open
23
24       filename_len - Length of filename
25
26       flags - Any reasonable combination of the LIBSSH2_FXF_* constants:
27
28              LIBSSH2_FXF_READ
29                     Open the file for reading.
30
31              LIBSSH2_FXF_WRITE
32                     Open  the  file  for  writing.   If  both  this  and LIB‐
33                     SSH2_FXF_READ are specified, the file is opened for  both
34                     reading and writing.
35
36              LIBSSH2_FXF_APPEND
37                     Force all writes to append data at the end of the file.
38
39              LIBSSH2_FXF_CREAT,
40                     If  this  flag is specified, then a new file will be cre‐
41                     ated if one does not already exist (if  LIBSSH2_FXF_TRUNC
42                     is  specified,  the  new  file  will be truncated to zero
43                     length if it previously exists)
44
45              LIBSSH2_FXF_TRUNC
46                     Forces an existing file with the same name  to  be  trun‐
47                     cated  to  zero length when creating a file by specifying
48                     LIBSSH2_FXF_CREAT. LIBSSH2_FXF_CREAT MUST also be  speci‐
49                     fied if this flag is used.
50
51              LIBSSH2_FXF_EXCL
52                     Causes  the request to fail if the named file already ex‐
53                     ists.  LIBSSH2_FXF_CREAT MUST also be specified  if  this
54                     flag is used.
55
56       mode - POSIX file permissions to assign if the file is being newly cre‐
57       ated. See the LIBSSH2_SFTP_S_* convenience defines in <libssh2_sftp.h>
58
59       open_type - Either of LIBSSH2_SFTP_OPENFILE (to open a  file)  or  LIB‐
60       SSH2_SFTP_OPENDIR (to open a directory).
61

RETURN VALUE

63       A  pointer to the newly created LIBSSH2_SFTP_HANDLE instance or NULL on
64       failure.
65

ERRORS

67       LIBSSH2_ERROR_ALLOC -  An internal memory allocation call failed.
68
69       LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
70
71       LIBSSH2_ERROR_SOCKET_TIMEOUT -
72
73       LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was re‐
74       ceived  on  the  socket, or an SFTP operation caused an errorcode to be
75       returned by the server.
76
77       LIBSSH2_ERROR_EAGAIN - Marked for non-blocking I/O but the  call  would
78       block.
79

SEE ALSO

81       libssh2_sftp_close_handle(3)
82
83
84
85libssh2 0.15                      1 Jun 2007           libssh2_sftp_open_ex(3)
Impressum