FtpCommand Function  
 
INT WINAPI FtpCommand(
  HCLIENT hClient,  
  LPCTSTR lpszCommand,  
  LPCTSTR lpszParameter  
);

The FtpCommand function sends a command to the server and returns the result code back to the caller. This function is typically used for site-specific commands not directly supported by the API.

Parameters

hClient
Handle to the client session.
lpszCommand
The command which will be executed by the server.
lpszParameter
An optional command parameter. If the command requires more than one parameter, then they should be combined into a single string, with a space separating each parameter. If the command does not accept any parameters, this value may be NULL.

Return Value

If the function succeeds, the return value is the result code returned by the server. If the function fails, the return value is FTP_ERROR. To get extended error information, call FtpGetLastError.

Remarks

This function should only be used when the application needs to send a custom, site-specific command or send a command that is not directly supported by this API. This function should never be used to issue a command that opens a data channel. If the application needs to transform data as it is being sent or received, and cannot use the FtpGetFile or FtpPutFile functions, then use the FtpOpenFile function to open a data channel with the server.

By default, file names which are sent to the server using the FtpCommand function are sent as ANSI characters. If the Unicode version of the function is used, the file name will be converted from Unicode to ANSI using the current codepage. If the server supports UTF-8 encoded file names, the FtpSetFileNameEncoding function can be used to specify that file names with non-ASCII characters should be sent as UTF-8 encoded values. It is important to note that this option is only available if the server advertises support for UTF-8 and permits that encoding type. 

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

FtpGetFile, FtpGetFileNameEncoding, FtpGetResultCode, FtpGetResultString, FtpOpenFile, FtpPutFile, FtpSetFileNameEncoding