CFtpServer::GetCommandParam Method  
 
INT GetCommandParam
  UINT nClientId,  
  INT nParam,  
  LPTSTR lpszParam,  
  INT nMaxLength  
);
INT GetCommandParam
  UINT nClientId,  
  INT nParam,  
  CString& strParam  
);

Return the value of the specified command parameter from the last command issued by the client.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
nParam
An integer value which specifies the command parameter. A value of zero specifies the command itself, while values greater than zero specify a particular parameter. This method will fail if this value is less than zero or greater than the number of parameters available.
lpszParam
A pointer to a string buffer that will contain the command parameter. The string buffer will be null terminated and must be large enough to store the complete parameter value. If this parameter is NULL, the method will only return the length of the specified parameter in characters, not including the terminating null character. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters that can be copied into the string buffer, including the terminating null character. The internal limit on the maximum length of a command is 1024 characters. If the maximum length specified is smaller than the actual length of the parameter, this method will fail. If the lpszParam parameter is NULL, this value should be zero.

Return Value

An integer value which specifies the number of characters copied into the buffer, not including the terminating null character. If the method fails, the return value will be zero and the GetLastError method can be used to retrieve the last error code. If the last error code is returned as a value of zero, this means that no command has been issued by the client.

Remarks

The GetCommandParam method is used to obtain a specific parameter for the last command that was issued by the client. If the parameter was surrounded in quotes, those quotes will be included in the value returned by this method. This method is typically used inside the OnCommand and OnResult event handlers to pre-process and post-process client commands, respectively.

The GetCommandParamCount method will return the number of command parameters that were provided by the client. If the command sent by the client is used to perform an action on a file or directory, the GetCommandFile method should be called to obtain the full path to the specified file rather than using the value of the command parameter. To obtain the complete command line, use the GetCommandLine method.

Requirements

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

See Also

GetCommandFile, GetCommandLine, GetCommandName, GetCommandParamCount, OnCommand, OnResult