Hello all! I think I have figured out everything I need to know about ICE except for reading, writing, and manipulating data in an appvar. I've gone through all the basics of how data storage works, but there's still one thing I don't understand: what format info is stored in an appvar. If I wanted to store the string "HELLO" in an appvar, how would I do it? I also want to know how to read that data from that appvar. How could these both be done?
Easy: first you need to figure out the size of the string (I think there's a getSize function somewhere in the commands list). Or you could just figure it out yourself- uppercase characters are 1 byte, lowercase characters are 2. In this case, your string would be 5 bytes (I would use getSize for longer strings, or just use, say, 10 bytes, for every word in your appvar).

Creating the appvar and writing in your strings- A is the slot number

Code:
//Not necessary, but useful if you want to manipulate the string in any way.
"HELLO"->Str1
//Close all open slots
CloseAll()
//Create the appvar and store its slot number
Open("APPVAR","w+")->A
Write(Str1,5,1,A


To read it back out-

Code:
CloseAll()
Open("APPVAR","r")->A
Read(Str1,5,1,A


And that's all there is to it!
Thanks! This is just the kind of explanation I needed! Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement