InetFTPAutoRetrieve

int InetFTPAutoRetrieve (const char *FTPServer, const char *userName, const char *password, const char *localFile, const char *remoteFile, int transferType);

Purpose

Transfers a file from a remote FTP server to the local machine.

This high–level function logs in, changes directories, transfers the file, and logs out. The function closes the connection before it returns.

Note  You might need to use the lower–level functions to avoid errors if your application runs behind a firewall.

Parameters

Input
Name Type Description
FTPServer const char * The name or IP address of the remote machine. The remote machine must be running an FTP server on the standard FTP server port (21). If the FTP server is using a non-standard port, then you can specify the port using the syntax address:port.
userName const char * The user name to use when logging in to the FTP server.
password const char * The password to use when logging in to the FTP server. You may pass NULL if the server does not require a password. If you pass an empty string, the function uses an empty password.
localFile const char * The pathname of the destination file on the local machine. The path can be absolute or relative to the current working directory on the local machine.

If the file already exists, it is overwritten.
remoteFile const char * The pathname of the remote file to retrieve. The path can be absolute or relative to the current working directory on the remote machine.
transferType integer The mode in which the file is to be transferred. The following modes are valid:
INET_FTP_FILE_TYPE_ASCII

The file is converted into the local machine's ASCII file format (with regard to newlines and carriage returns).

INET_FTP_FILE_TYPE_BINARY

The file is transferred exactly as is.

Return Value

Name Type Description
result integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.