83Plus:Software:usb8x/BASIC Interface/ExportVariable

From WikiTI
Jump to: navigation, search

Synopsis

Name: ExportVariable

Function Number: 9

Minimum usb8x version: 0.10

Exports variable from RAM or Flash to specified directory as *.8x* file.

Inputs

  • 2: String variable to use (Str1-0)

Outputs

  • 1: Error code (0 = success)

Notes

Be sure to initialize the mass storage driver with MSDInit before calling this entry point.

This entry point will fail if a *.8x* file of the same name is already in the specified directory.

You have your choice of Str1-Str0 to use with this function. Pass this number as the second element in Ans.

String Format

The variable to export starts the string. It is the token for the variable you want to transfer. This means you must select this variable from a menu instead of typing it yourself (for example, selecting "Str9" from the VARS menu, not typing 'S', 't', 'r', '9'). A colon follows this, and finally the path to export the variable to.

For example, to send matrix A to the root directory, use the following for the string:

"[A]:/"

The "[A]" was selected from the [2nd]+[MATRX] menu.

To send prgmGAME to the "test" directory, use the following for the string:

"prgmGAME:/TEST"

To send a REAL variable or AppVar, simply enter the string. If a REAL variable and AppVar have the same name, it will send the REAL variable. To send AppVar ABC to the root directory:

"ABC:/"

Do not enter lowercase letters in the string.

Example

The following code will export ZTETRIS to the root directory:

OpenLib(USBDRV8X
{7
ExecLib ;initialize mass storage driver
"prgmZTETRIS:/->Str1
{9,1
ExecLib ;export variable in Str1

See Also

MSDInit - Initialize the mass storage driver