GetErrorMessage
Returns a newline separated list of error messages that have been generated since the last call to GetErrorMessage. When an API function does not return success, A call to this function will give a list of errors that may be responsible for the failure.
Parameters:
buffer
The buffer that will contain the comma separated list.
bufferLen
The size of the buffer (used to prevent an overrun).
Return Value:
The number of characters that were copied into the buffer (including the termination character). If this value is zero there were no error messages.
Prototype Signature:
int GetErrorMessage(char* buffer, int bufferLen);
An example of how this function could be used is shown below.
#include <malloc.h>
#include <string.h>
#include "api.h"
int main()
{
success successful;
int bufferLen = 1024;
char* responseBuffer = malloc(bufferLen);
int bytesCopied;
//Initialize the library with a specific configuration file
successful = Initialize("C:\\Temp\\MyConfig.ini");
if(!successful)
{
//Get the comma separated list of errors that have occured
bytesCopied = GetErrorMessage(responseBuffer, bufferLen);
if(bytesCopied > 0)
printf(responseBuffer);
}
}