SilverScreen Solid Modeler

load_ss_variable

load_ss_variable

Previous topic Next topic  

load_ss_variable

Previous topic Next topic JavaScript is required for the print function  

SilverScreenAPI

 

int load_ss_variable ( char *name, SS_VARIABLE *var )

 

char        *name;     // name of a SilverScreen variable

SS_VARIABLE *var;      // address of variable structure

 

 




Synopsis

#include "silver.h"

 

The load_ss_variable function attempts to load the value of the specified SilverScreen system variable into the SS_VARIABLE record pointed to by var .

 

 

Parameters

name is a null-terminated string containing the name of a SilverScreen variable (including the leading '$'). var is the address of an SS_VARIABLE structure, as defined in silver.h .

 

 

Return Value

load_ss_variable returns one of the following:

 

Constant

Meaning

SS_SUCCESS

the function was performed successfully

SS_NOTFOUND

the specified variable was not found

SS_NOMEMORY

the specified variable was found and is of type V_TEXT ; however, no memory to hold the text string could be allocated.

 

 

Comments

For text variables, the memory to hold the text string is allocated and assigned to the text field of the var parameter. unload_ss_variable should be called to deallocate the memory used by the text string when you are finished using it. There is no harm in calling unload_ss_variable for non-text variables.

 

 

See Also

sysvar_text, sysvar_value, sysvar_xyz, unload_ss_variable

 

 

Example

Assume that $tvar is the name of a SilverScreen system text variable:

C / C++ Code

 

 #include "silver.h"

 ...

 SS_VARIABLE var;

 if ( load_variable ( "$tvar", &var ) == SS_SUCCESS && var.type == V_TEXT )

    {

    ss_command ( "note tvar = %s", var.text );

    unload_ss_variable(&var);

    }