<< Back


FVSDK_GetLastResponse

Synopsis

FVSDK_ERROR_CODE FVSDK_GetLastResponse(FVSDK_Session* pSession, UINT nIndex, char* pszBuffer, int nBufferSize);

Description

Fills pszBuffer with a NULL terminated string containing the requested line of the last response to an FTP command. FTP responses can consist of multiple lines of text.

Parameters

nIndex

The zero-based index of the requested line of the last response string. If nIndex is out of range, FVSDK_GetLastResponse() returns FVSDK_NO.

pszBuffer

A pointer to a buffer that will receive the null terminated string containing the last response from the server. pszBuffer will be filled with the response string up to the length of (nBufferSize - 1). This function will always ensure pszBuffer is a NULL terminated string.

nBufferSize

The size of pszBuffer in bytes.

Return Value

FVSDK_OK if nIndex is a valid index into the last response string; FVSDK_NO, if not. Error codes can be found in FVSDK_ErrorCodes.h.

Example

// buffer for getting the last response
char    pszBuffer[128];
int     nIndex = 0;
CString sResponse;

// get responses to the last command
while (FVSDK_GetLastResponse(pSession, nIndex++, pszBuffer, sizeof(pszBuffer)) == FVSDK_OK) {

    // add the response to the message string
    sResponse += pszBuffer;

    // add a <CR><LF> for formatting
    sResponse += "\r\n";
} // while

// show the last full response in a message box
AfxMessageBox(sResponse, (MB_ICONINFORMATION | MB_OK));