|
ZCslGetError |
|
long ZCslGetError( /* get error text */ ZCslHandle aHandle, /* CSL handle */ long aIndex, /* index of text (0 based) */ char *aBuffer, /* buffer for error text (NULL = query size) */ long *aSize /* buffer size information */ ); Retrieve error text. aIndex must be in the range from 0 to the # of errors returned by the previous API call. On entry *aSize must be set to the actual size of the buffer. No more than this amount will be filled including zero termination. The rest of the variable content will in case be truncated. On exit *aSize is always set to the buffer size required for holding the full value. Pass aBuffer as NULL to only query the required buffer size. If aSize is NULL, the API assumes your buffer is in any case large enough and will not limit the size at all (I strongly don't recommend this!). Example:
void handleCslError(ZCslHandle csl, long errs)
{
long i, size, errs2;
char *buf;
for (i = 0; i < errs; i++) {
/* get size of text first for buffer allocation: */
errs2 = ZCslGetError(csl, i, NULL, &size);
if (errs2) handleCslError(csl, errs2);
/* now allocate buffer and retrieve text */
buf = (char*)malloc(size);
errs2 = ZCslGetError(csl, i, buf, &size);
if (errs2) handleCslError(csl, errs2);
/* display message */
fprintf(stderr, "%s\r\n", buf);
/* when value no longer needed, don't forget to release buffer */
free(buf);
} /* for */
if (errs) exit(1);
} /* handleCslError */
|
||||||||
| Copyright © IBK Landquart | Last revision: 27.05.2002 | << Back Top Next >> |