Symisc Systems

Libcox C/C++ API Reference - Obtaining Libcox Object Values


Star Follow @symisc

Syntax

int libcox_value_to_int(libcox_value *pValue);

int libcox_value_to_bool(libcox_value *pValue);

libcox_int64 libcox_value_to_int64(libcox_value *pValue);

double libcox_value_to_double(libcox_value *pValue);

const char * libcox_value_to_string(libcox_value *pValue,int *pLen);


Obtaining Libcox objects values.

Description

These routines are used to extract values from the libcox_value objects obtained by a prior successful call to libcox_exec or inside a foreign command. Please note that if the libcox_value is not of the expected type, an automatic cast will be performed.

The libcox_value_to_string() interface takes an optional parameter (int *pLen) which is set (if not NULL) to the string length. Also note, this function return a null terminated string and does never return the NULL pointer.

Please pay particular attention to the fact that the pointer returned from libcox_value_to_string() can be invalidated by subsequent call to libcox_value_to_int(), libcox_value_to_bool(), libcox_value_to_int64() or libcox_value_to_double().


Parameters

pValue

A pointer to a libcox value.


Return value

Value of the given parameter.


See also

Libcox Object Values Type, Populating Object Values, Setting the Result of a Foreign Command.