tfFSGetNextDirEntry

Jump to: navigation, search

Table of Contents >> Application Reference >> File System Interface


#include <trsocket.h>


int tfFSGetNextDirEntry (
void * userDataPtr,
void * dirDataPtr,
char * bufferPtr,
int bufferSize
);


Function Description

Given the unique user data pointer as returned by tfFSUserLogin() and a directory data pointer as returned by tfFSOpenDir(), this function retrieves the next entry in the directory that matches the path given as an argument to tfFSOpenDir(). The next entry should be either a long listing of the next directory entry (either volume name, sub-directory, or file name with its attribute), or a short listing of the directory entry (file name only without any attribute), and should be stored in the buffer pointed to by 'bufferPtr' (up to 'bufferSize' bytes).


FTP Server Note

The FTP server will continue calling tfFSGetNextDirEntry() until it gets a return value of 0 bytes, indicating that all matching directory entries have been retrieved. It is up to the developer of tfFSGetNextDirEntry() to keep track of how many entries of the listing have been read so far, whether the directory was open for long or short listing, and the matching pattern (using 'dirDataPtr').


Parameters

  • userDataPtr
    Pointer to user data structure as returned by tfFSUserLogin().
  • dirDataPtr
    Pointer to newly allocated directory data structure.
  • bufferPtr
    Pointer to a buffer where to copy the next directory entry.
  • bufferSize
    Size in bytes of the buffer.


Returns

  • >0
    Number of bytes copied into the buffer pointed to by 'bufferPtr'.
  • 0
    End of directory.
  • -1
    Failure.


Table of Contents >> Application Reference >> File System Interface