1libssh2_sftp_open_ex_r(3)           libssh2          libssh2_sftp_open_ex_r(3)
2
3
4

NAME

6       libssh2_sftp_open_ex_r - 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_r(LIBSSH2_SFTP *sftp, const char *filename,
14                              size_t filename_len,
15                              unsigned long flags,
16                              long mode,
17                              int open_type,
18                              LIBSSH2_SFTP_ATTRIBUTES *attrs);
19

DESCRIPTION

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

RETURN VALUE

68       A pointer to the newly created LIBSSH2_SFTP_HANDLE instance or NULL  on
69       failure.
70

ERRORS

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

AVAILABILITY

86       Added in libssh2 1.11.0
87

SEE ALSO

89       libssh2_sftp_close_handle(3) libssh2_sftp_fstat_ex(3)
90
91
92
93libssh2                           10 Apr 2023        libssh2_sftp_open_ex_r(3)
Impressum