Libssh2 sftp readdir
From Libssh2
int libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
[edit]
About
Read a block of data from a LIBSSH2_SFTP_HANDLE. This method is modeled after the POSIX readdir(); however, it uses a variable sized directory entry (filename) buffer and returns statbuf type data in the same call.
[edit]
Parameters
- handle
- SFTP File Handle as returned by libssh2_sftp_opendir().
- buffer
- Pre-allocated buffer of at least buffer_maxlen bytes to copy the filename data into.
- buffer_maxlen
- Length of buffer in bytes. If the length of the filename is longer than the space provided by buffer_maxlen it will be truncated to fit.
- attrs
- Pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate statbuf style data into.
[edit]
Returns
- On Success:
- Length of NUL-terminated directory entry (filename) populated into buffer
- On Failure:
- -1
