ePass1000 C/C++ API Reference Manual Version 2.0

# epas_Directory

The epas_Directory function is used to enumerate files and directories under the current directory. Use epas_ChangeDir to change into the desired directory. The index should be set to 0 for the first call and incremented until all information desired has been returned.

    EPAS_STATUS EPAS_API
    epas_Directory(
        EPAS_HANDLE hContextHandle,       // [in]
        unsigned long ulFlags,            // [in]
        unsigned long ulIndex,            // [in]
        PEPAS_FILEINFO pFileInfo,         // [out]
        unsigned long ulSizeOfFileInfo    // [in]
    );

#### Requirement

epas_CreateContext, epas_OpenDevice

#### Parameters

hContextHandle
  [in] Handle to device context.
ulFlags
  [in] Reserved for future extension. Must be set to zero.
ulIndex
  [in] A zero-based index value of the entries returned. To enumerate all directories and files, increment this value upon each call.
pFileInfo
  [out] Pointer to an EPAS_FILEINFO structure that receives the file information for the entry specified by the ulIndex parameter.

  You should first zero initialize this structure before invoke the epas_Directory function.

ulSizeOfFileInfo
  [in] Size of the buffer that pFileInfo points to.

#### Remarks

To enumerate all directories and files on a device, initialize the ulIndex parameter to zero, and increment it upon each successive call to epas_Directory. When no more directories and files remain, FT_FILE_NOT_FOUND will be returned.

For a list of reserved directory IDs, see EPAS_DIRINFO.

#### Return Values

If the function succeeds, FT_SUCCESS returned.

If the specified directory not found, FT_DIR_NOT_FOUND returned.

If the specified file not found, FT_FILE_NOT_FOUND returned.

For a list of all return codes, see Status Return Values.

#### See Also

epas_CreateFile, epas_DeleteFile, epas_OpenFile, epas_CloseFile, epas_GetFileInfo, epas_Read, epas_Write, epas_CreateDir, epas_DeleteDir, epas_GetCurrentDir, epas_ChangeDir