<< Back


FVSDK_FindNextFile

Synopsis

FVSDK_ERROR_CODE FVSDK_FindNextFile(FVSDK_Session* pSession, FVSDK_FileInfo* pFileInfo);

Description

A successful call to FVSDK_FindFile() must precede any calls to FVSDK_FindNextFile. First, this function fills the pFileInfo structure with the information about the current file. Next, this function returns FVSDK_YES if another file or subdirectory exists in the listing, or FVSDK_NO if there are no more files or subdirectories found.

Parameters

pSession

A pointer to the FVSDK_Session that is to perform the operation.

pFileInfo

A pointer to an FVSDK_FileInfo structure that is used to receive the information about the current file.

Return Value

FVSDK_YES if another file exists; FVSDK_NO if there are no more files. Error codes can be found in FVSDK_ErrorCodes.h.

Example

// find the file or files in the current directory
if (FVSDK_FindFile(pSession, "*") == FVSDK_YES) {
    FVSDK_ERROR_CODE    fvecRet;
    FVSDK_FileInfo      FileInfo;

    // initialize the file info structure
    FileInfo.nVersion   = FVSDK_FILE_INFO_CURRENT_VERSION;
    FileInfo.nSize      = sizeof(FileInfo);

    // find each of the files in the current directory all
    do {

        // get the current file information and move to the next file
        fvecRet = FVSDK_FindNextFile(pSession, &FileInfo);

        // ... perform some operations ...

    } while ((fvecRet == FVSDK_YES) && (! FVSDK_LastOperationStopped(pSession)));
} // if
else
    AfxMessageBox("No files were found.");

// close the file find operation
FVSDK_FindFileClose(pSession);