3.3.65. scriba_SetVariable()

[<<<] [>>>]

This function sets the value of a global BASIC variable. You can call this function after executing the program before it is reexecuted or after successfull call to @xref{scriba_NoRun()}.

int scriba_SetVariable(pSbProgram pProgram,
                       long lSerial,
                       int type,
                       long lSetValue,
                       double dSetValue,
                       char *pszSetValue,
                       unsigned long size
  ){
The argument lSerial should be the serial number of the global variable as returned by @xref{scriba_LookupVariableByName()}.

The argument type should be one of the followings:

The function uses one of the arguments lSetValue, dSetValue or pszSetValue and the other two are ignored based on the value of the argument type.

If the value of the argument type is SBT_UNDEF all initialization arguments are ignored and the global variable will get the value undef.

If the value of the argument type is SBT_DOUBLE the argument dSetValue will be used and the global variable will be double holding the value.

If the value of the argument type is SBT_LONG the argument lSetValue will be used and the global variable will be long holding the value.

If the value of the argument type is SBT_STRING the argument pszSetValue will be used and the global variable will be long holding the value. The length of the string should in this case be specified by the variable size.

If the value of the argument type is SBT_ZCHAR the argument pszSetValue will be used and the global variable will be long holding the value. The length of the string is automatically calculated and the value passed in the variable size is ignored. In this case the string pszSetValue should be zero character terminated.

The funtion returns SCRIBA_ERROR_SUCCESS on success,

SCRIBA_ERROR_MEMORY_LOW if the data cannot be created or

SCRIBA_ERROR_FAIL if the parameter lSerial is invalid.


[<<<] [>>>]