Libssh2 sftp open ex

From Libssh2

LIBSSH2_SFTP_HANDLE *libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp,
                     char *filename, int filename_len,
                     unsigned long flags, long mode, int open_type);

#define libssh2_sftp_open(sftp, filename, flags, mode) \
        libssh2_sftp_open_ex((sftp), (filename), strlen(filename), \
                             (flags), (mode), LIBSSH2_SFTP_OPENFILE)

#define libssh2_sftp_opendir(sftp, path) \
        libssh2_sftp_open_ex((sftp), (path), strlen(path), 0, 0, LIBSSH2_SFTP_OPENDIR)

Parameters

  • sftp
    SFTP instance as returned by libssh2_sftp_init().
  • filename
    Remote file/directory resource to open
  • filename_len
    Length of filename
  • flags
    Any (reasonable) combination of the LIBSSH2_FXF_* constants corresponding fopen modes.
  • mode
    POSIX file permissions to assign if the file is being newly created.
  • open_type
    Either of LIBSSH2_SFTP_OPENFILE (to open a file) or LIBSSH2_SFTP_OPENDIR (to open a directory).

Returns