InetFTPGetDirList
int InetFTPGetDirList (int FTPHandle, char ***listOfFiles, int *numberOfFiles);
Purpose
Gets the list of files in the current directory on the FTP server. This function first sends the "NLST -aF" command to the FTP server. If this command fails, the function sends the "NLST" command to the server because some servers do not support "NSLT -aF" but support the "NLST" command.
Parameters
Input | ||
Name | Type | Description |
FTPHandle | int | A handle returned by the InetFTPLogin or InetFTPLoginEx function. The handle identifies an active FTP connection. |
Output | ||
Name | Type | Description |
listOfFiles | char ** | Pass the address of a char ** variable. The function sets this variable to point to an array of NUL–terminated strings. Each string contains one filename from the current directory of the remote machine. When you no longer need the list, free the memory used for the array and strings by calling the InetFreeMemory function as shown in the following example: char ** files = NULL; InetFTPGetDirList (ftpHandle, &files, &numFiles); /* Print the files */ printf ("File[%d]: %s\n", i, files[i]); } /* Dispose the files - free each file and the array */ InetFreeMemory (files[i]); } } |
numberOfFiles | int | Contains the number of files in the list returned in the listOfFiles parameter. |
Return Value
Name | Type | Description |
result | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: Internet Library
Include file: cvintwrk.h
LabWindows/CVI compatibility: LabWindows/CVI 7.1 and later
Example
Refer to internet\ftpclnt\ftpclnt.cws for an example of using the InetFTPGetDirList function.