CFtpClient::GetNextFile Method  
 
BOOL GetNextFile(
  LPFTPFILESTATUS lpFileStatus  
);

The GetNextFile method returns the next file in the directory listing returned by the server.

Parameters

lpFileStatus
A pointer to an FTPFILESTATUS structure which contains information about the file returned by the server.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetNextFile method returns the next file in the directory listing. If the last file has been returned, the method will return zero and the client should call the CloseDirectory method to close the directory.

Example

if (pClient->OpenDirectory() != FTP_ERROR)
{
    FTPFILESTATUS ftpFile;
    BOOL bResult;

    bResult = pClient->GetFirstFile(&ftpFile);
    while (bResult)
    {
        // The ftpFile structure contains information about the file
        bResult = pClient->GetNextFile(&ftpFile);
    }

    pClient->CloseDirectory();
}

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: csftpv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

CloseDirectory, GetDirectoryFormat, GetFileStatus, GetFirstFile, OpenDirectory, SetDirectoryFormat