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

The GetFirstFile method returns the first file in the directory listing returned by the server after a call to the OpenDirectory method.

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

This file list information returned by the server is cached by the library, allowing you to use this method to reposition back to the beginning of the file list.

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, GetNextFile, OpenDirectory, SetDirectoryFormat