KCssGetError

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
Directives
System Library
String Library
Regular Expression Lib.
File Library
Database Library
C API
   Embedding CSS
   Writing Libraries
   API Reference
      KCssAddFunc
      KCssCall
      KCssClose
      KCssEnableTrace
      KCssGet
      KCssGetError
      KCssGetResult
      KCssIsTrace
      KCssLoadLibrary
      KCssLoadScriptFile
      KCssLoadScriptMem
      KCssOpen
      KCssSet
      KCssSetError
      KCssSetResult
      KCssShow
      KCssStartDate
      KCssStartTime
      KCssVarResize
      KCssVarSizeof
C++ API
CSS Links
  
long KCssAPI KCssGetError(               /* get error text */
   KCssHandle aHandle,                      /* CSS 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 allways set to the buffersize 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 handleCssError(KCssHandle css, long errs)
{
   for (long i = 0; i < errs; i++) {
      // get size of text first for buffer allocation:
      long size, errs2;
      errs2 = KCssGetError(css, i, NULL, &size);
      if (errs2) handleCssError(css, errs2);
 
      // now allocate buffer and retrieve text
      char* buf = new char[size];
      errs2 = KCssGet(css, i, buf, &size);
      if (errs2) handleCssError(css, errs2);
 
      // display message
      cerr << buf << endl;
 
      // when value no longer needed, dont forget to release buffer
      delete [] buf;
   } // for
   if (errs) exit(1);
} // handleCssError
 Copyright © IBK LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>