Saving variables
Author |
Message |
Task Bar
|
Posted: Wed Sep 29, 2004 2:05 pm Post subject: Saving variables |
|
|
hello, I need help with saving variables after closing the program. I want to store the variables in a txt file and recall them the next time I runt he program again. So if I input a name and then exit the program and run it again turing will put the name without asking me to input it again. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Wed Sep 29, 2004 2:29 pm Post subject: (No subject) |
|
|
Your basic approach is going to be to test for the existence of a file (let's call it "name.dat"). If it exists, then you've saved the variable, and you can retrieve its value from the file.
If not, you just prompt for the name nomally, then open name.dat and write the name to it.
Turing may have facilities for doing this already. Look for "serialization". |
|
|
|
|
|
Delos
|
|
|
|
|
|
|