ZCslGetError

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
Directives
System library
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
Registry/Profile handling
Windows control
C API
   Embedding CSL
   Writing libraries
   API reference
      ZCslAddFunc
      ZCslAddVar
      ZCslCall
      ZCslCallEx
      ZCslClose
      ZCslGet
      ZCslGetError
      ZCslGetResult
      ZCslLoadLibrary
      ZCslLoadScriptFile
      ZCslLoadScriptMem
      ZCslOpen
      ZCslSet
      ZCslSetError
      ZCslSetResult
      ZCslSetTraceMode
      ZCslShow
      ZCslStartDateTime
      ZCslTrace
      ZCslTraceMode
      ZCslVarExists
      ZCslVarResize
      ZCslVarSizeof
C++ Class Interface
CSL links
  
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 >>