Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Saving data to file?

Author
Message
Sheffield
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location:
Posted: 19th Dec 2004 05:24
I cant understand how saving data to file works...
I have this code:


aa#=0
open to read 1,"test.txt"
read file 1,aa#
print aa#
suspend for key

and test.txt file contains:

aa#=1

And still the program says that aa#=0 (bad english, sorry)
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 19th Dec 2004 06:05

you have to write a float before you can read one. you can use read float or read file.
Sheffield
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location:
Posted: 19th Dec 2004 06:46
Okay... thanks.

But when I change code to this:

aa#=0
open to read 1,"test.txt"
read file 1,aa#
print aa#
close file 1
suspend for key

aa# should be 1 because it's saved in test.txt, but this shows 0.

Why?
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 19th Dec 2004 08:08

ok, if you write float you should read float. you should delete the old file first if the file exists before you write to it again.
Sheffield
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location:
Posted: 19th Dec 2004 19:44
Thank you very much!

Login to post a reply

Server time is: 2024-09-23 07:39:19
Your offset time is: 2024-09-23 07:39:19