1
.\" Copyright (C) The libssh2 project and its contributors.
2
.\" SPDX-License-Identifier: BSD-3-Clause
3
.TH libssh2_sftp_open_ex_r 3 "10 Apr 2023" "libssh2" "libssh2"
5
libssh2_sftp_open_ex_r - open filehandle for file on SFTP.
9
#include <libssh2_sftp.h>
12
libssh2_sftp_open_ex_r(LIBSSH2_SFTP *sftp, const char *filename,
17
LIBSSH2_SFTP_ATTRIBUTES *attrs);
20
\fIsftp\fP - SFTP instance as returned by \fIlibssh2_sftp_init(3)\fP
22
\fIfilename\fP - Remote file/directory resource to open
24
\fIfilename_len\fP - Length of filename
26
\fIflags\fP - Any reasonable combination of the LIBSSH2_FXF_* constants:
29
Open the file for reading.
31
Open the file for writing. If both this and LIBSSH2_FXF_READ are specified,
32
the file is opened for both reading and writing.
34
Force all writes to append data at the end of the file.
36
If this flag is specified, then a new file will be created if one does not
37
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be
38
truncated to zero length if it previously exists)
40
Forces an existing file with the same name to be truncated to zero length when
41
creating a file by specifying LIBSSH2_FXF_CREAT. LIBSSH2_FXF_CREAT MUST also
42
be specified if this flag is used.
44
Causes the request to fail if the named file already exists.
45
LIBSSH2_FXF_CREAT MUST also be specified if this flag is used.
48
\fImode\fP - POSIX file permissions to assign if the file is being newly
49
created. See the LIBSSH2_SFTP_S_* convenience defines in <libssh2_sftp.h>
51
\fIopen_type\fP - Either of LIBSSH2_SFTP_OPENFILE (to open a file) or
52
LIBSSH2_SFTP_OPENDIR (to open a directory).
54
\fIattrs\fP - Pointer to LIBSSH2_SFTP_ATTRIBUTES struct. See
55
libssh2_sftp_fstat_ex for detailed usage.
58
A pointer to the newly created LIBSSH2_SFTP_HANDLE instance or NULL on
61
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
63
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
65
\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP -
67
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
68
received on the socket, or an SFTP operation caused an errorcode to be
69
returned by the server.
71
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
74
Added in libssh2 1.11.0
76
.BR libssh2_sftp_close_handle(3)
77
.BR libssh2_sftp_fstat_ex(3)