ZCslSetResult

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 ZCslSetResult(        /* set return result */
   ZCslHandle aHandle,        /* CSL handle */
   const char *aBuffer,       /* buffer for result */
   long aSize                 /* buffer size, -1 = ASCIZ */
);

Set return value in a C/C++ function implementation.

ZCslSetResult will always return 0 so there is no need for error checking.

Example:

ZExportAPI(void) mthSqrt(ZCslHandle aCsl)
{
   char buf[40];
   long bufsiz;
   double val;
 
   /* get val */
   bufsiz = sizeof(buf);
   if ( ZCslGet(aCsl, "val", buf, &bufsiz) ) return;
   val = atof(buf);
 
   if (val < 0.0) {
      ZCslSetError(aCsl, "val must not be negative!", -1);
      return;
   } /* if */
 
   /* return result */
   sprintf(buf, "%f", sqrt(val));
   ZCslSetResult(aCsl, buf, -1);
} /* mthSqrt */
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>