On the emulator, if I use ti_open("FILENAME", "r") when FILENAME.8xv doesn't exist, the program exist immediately. I don't know if its my problem with another section of the program, but the docs does state "The file must exist." how do I get it to return 0 instead?
thank
ti_Open is supposed to return 0 on error, not exit the program. What does your code look like?
then its probably my program then. Thanks for info.
Ok I figured it out. The program successfully detected the file not exist, so it goes to the next step which is to use os_PutStrFull("Could not find or locate SOMEFILE.8xv"); which only displayed C for each file missing... I did not see the C as it was in the top left corner lol.
but that was because i forgot to os_NewLine(); and os_NewLine();
ahhh dumb errors and how they hide and disguise themselves!
Hey. Even when the file exists, my program still claims that the appvar does not exist.
I used convbin to create the Appvar, with the command:
convbin -r -j bin -k 8xv -i PokeData.bin -o PokeData.8xv -n PokeData
successfully creates appvar PokeData.8xv.
Send to calculator, checks memory. PokeData is in the app var section.
Then I try to use ti_Open("PokeData", "r"); returns 0.
Also, there's an extra:
**TI83F*
in the header, with two other lines that I am assuming account for the name. Please tell me what I did wrong.
Make sure that you call ti_CloseAll before using any of the fileioc functions.
The **TI83F* is normal - the 8xv file contains a header to tell TI-Connect what the variable name and type is, as well as whether it should be archived.
Worked. Well I guess I didn't read the documentation carefully. Though the explanation was a bit weird. "use before calling variable functions" should list example of the functions... seemed like something from reader.close() which I expected to be called after ti_open.
Yolomep wrote:
Worked. Well I guess I didn't read the documentation carefully. Though the explanation was a bit weird. "use before calling variable functions" should list example of the functions... seemed like something from reader.close() which I expected to be called after ti_open.
You can always change/improve the documentation yourself
Ok I will go and write a change to the documentation.
On another note,
when I use
Code:
gfx_sprite_t *behind_sprite = gfx_MallocSprite(8, 8);
int main() {
//... background stuff, initiate gfx... etc
//error!
gfx_GetSprite(behind_sprite, 120, 120);
//other code
}
breaks and causes the ram to reset, but this does not:
Code:
gfx_UninitedSprite(behind_sprite, 8, 8);
int main() {
//... background stuff, initiate gfx... etc
behind_sprite->width = 8;
behind_sprite->height = 8;
//fine
gfx_GetSprite(behind_sprite, 120, 120);
//other code
}
I admit I don't know much about Malloc, my education in c++ didn't include any of that. Teacher just told us to use vector or some other data structure if we needed something dynamic.
Because gfx_MallocSprite calls malloc, it has to be run inside a function. I'm not sure why that even compiles, actually.
You should avoid using malloc on the CE whenever possible. You should either use UninitedSprite or TempSprite for this use case.
commandblockguy wrote:
Because gfx_MallocSprite calls malloc, it has to be run inside a function. I'm not sure why that even compiles, actually.
Nah you can use code to initialize globals outside of functions. People should stop using globals.