Its a bit wonky, but I just edited the example code for fileioc/read_write with some funky code (I don't think this is the right way to use two appvars):
Code:
#include <tice.h>
#include <fileioc.h>
int main(void)
{
char nameBuffer[10];
ti_var_t var;
char string[] = "AppVar string";
ti_var_t var2;
/* Clear the homescreen */
os_ClrHome();
/* Open a new variable; deleting it if it already exists */
var = ti_Open("AppVar", "w");
//extra
var2 = ti_Open("Ao", "w");
if (var == 0)
{
return 1;
}
//extra
if (var2 == 0)
{
return 1;
}
/* Write characters to the appvar */
if (ti_PutC('a', var) == EOF)
{
os_PutStrFull("Failed character");
while (!os_GetCSC());
return 1;
}
/* Write the structure to the appvar */
//extra
ti_Write(string, sizeof(string), 1, var2);
if (ti_Write(string, sizeof(string), 1, var) != 1)
{
os_PutStrFull("Failed string write");
while (!os_GetCSC());
return 1;
}
/* Go back to the start of the file */
if (ti_Rewind(var) == EOF)
{
os_PutStrFull("Failed rewind");
while (!os_GetCSC());
return 1;
}
/* Read character from the appvar */
if (ti_GetC(var) != 'a')
{
os_PutStrFull("Failed character read");
while (!os_GetCSC());
return 1;
}
/* Read string back to same location */
if (ti_Read(string, sizeof(string), 1, var) != 1)
{
os_PutStrFull("Failed readback");
while (!os_GetCSC());
return 1;
}
//extra
if (ti_Read(string, sizeof(string), 1, var2) != 1)
{
os_PutStrFull("Failed readback");
while (!os_GetCSC());
return 1;
}
/* Ensure the name of the AppVar is correct */
//makes nameBuffer ao instead of AppVar
ti_GetName(nameBuffer, var);
/* Ensure that the slot is closed */
ti_Close(var);
ti_Close(var2);
var = 0;
os_SetCursorPos(0, 0);
os_PutStrFull("Appvar: ");
os_SetCursorPos(0, 8);
os_PutStrFull(nameBuffer);
os_SetCursorPos(1, 0);
os_PutStrFull(string);
/* Waits for a key */
while (!os_GetCSC());
return 0;
}
try on your emulator. it could be also a problem with my emulator after I messed around with all the features, but I don't think thats a problem.