eimErr2String()--Convert EimRC into an Error Message
Syntax
#include <eim.h> char * eimErr2String(EimRC * eimrc)Service Program Name: QSYS/QSYEIM
Default Public Authority: *USE
Threadsafe: Yes
The eimErr2String() function converts the EIM return code structure returned by an EIM function into a NULL-terminated error message string. free() should be used to free the space allocated for the error message string.
Authorities
No authorization is required.
Parameters
- eimrc (Input)
- The structure that contains error code information from a previous call to
an EIM API. For the format of the structure, see EimRC--EIM
Return Code Parameter.
Return Value
If successful, the return value is the address of the error message. The caller is responsible for freeing the message.
If unsuccessful, eimErr2String returns a NULL pointer. The errno global variable is set to indicate the error. The errno may come from catopen, catget, or catclose or one of the following values.
- EBADDATA
- eimrc is not valid.
- ECONVERT
- Data conversion error.
- EINVAL
- Input parameter was not valid.
- ENOMEM
- Unable to allocate required space.
- EUNKNOWN
- Unexpected exception.
Related Information
- eimRC() --EIM Return Code Parameter
Example
The following example converts an EimRC into an error message and prints it.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <eim.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char *argv[])
{
int rc;
EimRC * err;
char * errMessage;
/* Get EimRC from input arg. */
err = (EimRC *)argv[1];
/* Get error message */
if (NULL == (errMessage = eimErr2String(err)))
{
printf("eimErr2String error = %s", strerror(errno));
return -1;
}
/* Print the message */
printf("%s", errMessage);
free(errMessage);
return 0;
}
API introduced: V5R2
[ Back to top | Security APIs | APIs by category ]