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 */
|