ZCslGetResult

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 ZCslGetResult(        /* get function result */
   ZCslHandle aHandle,        /* CSL handle */
   char *aBuffer,             /* buffer for value (NULL = query size) */
   long *aSize                /* buffer size */
);

Retrieve return value of a CSL function 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:

static char *args[] = { "The quick brow fox", "5", "10" };
char *buf;
long errs, size;
 
/* call strSubString */
errs = ZCslCall(csl, "MyProg.exe", "strSubString", sizeof(args)/sizeof(char*), args);
if (errs) .... /* error handling */
 
/* get size of return value first for buffer allocation: */
errs = ZCslGetResult(csl, NULL, &size);
if (errs) .... /* error handling */
 
/* now allocate buffer and retrieve value */
buf = (char*)malloc(size);
errs = ZCslGetResult(csl, buf, &size);
if (errs) .... /* error handling */
 
...
 
/* when value no longer needed, don't forget to release buffer */
free(buf);
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>