The aftp_format_error call retrieves the current AFTP error information to a text buffer. The AFTP return code for the current error must not be AFTP_RC_HANDLE_NOT_VALID. If the current status is AFTP_RC_OK and the aftp_format_error call is invoked, the return_code value output by this call is AFTP_RC_STATE_CHECK. The aftp_format_error call should only be invoked when an error has occurred.
AFTP_ENTRY aftp_format_error(
IN AFTP_HANDLE_TYPE connection_id,
IN AFTP_DETAIL_LEVEL_TYPE detail_level,
OUT unsigned char AFTP_PTR error_str,
IN AFTP_LENGTH_TYPE error_str_size,
OUT AFTP_LENGTH_TYPE AFTP_PTR returned_length,
OUT AFTP_RETURN_CODE_TYPE AFTP_PTR return_code
);
Use the AFTP_MESSAGE_SIZE constant to define the length of this buffer. Add 1 to the size if you want to be able to add a null terminator to the text in the buffer.
{
AFTP_HANDLE_TYPE connection_id;
AFTP_RETURN_CODE_TYPE aftp_rc;
unsigned char error_string[AFTP_MESSAGE_SIZE+1];
AFTP_LENGTH_TYPE returned_length;
/*
* There are no specific prerequisite calls for this call,
* but you must issue a call that returns an error return code
*/
if (aftp_rc != AFTP_RC_OK) {
/*
* We had an AFTP error - so let's get
* the description that corresponds to
* the error.
*/
aftp_format_error(
connection_id,
AFTP_DETAIL_ALL,
error_string,
(AFTP_LENGTH_TYPE)sizeof(error_string)-1,
&returned_length,
&aftp_rc);
}
}
None.