Page 1 of 1

Save Function

Posted: Thu Apr 21, 2005 3:14 pm
by Anonymous
Hello everybody,

I was wondering if you could help me with a puzzle i've been trying to figure out for awhile.

I have been writing a simple program in QB that uses numbers in strings to keep track of the game's situation.

The problem I have is I can't figure out how to save those numbers to a file on the computer and then re-load them back up and get them in to the right strings again.

Any ideas?

I use Strings like A, B,C, D, E, etc. I just can't get the numbers to get re-assigned to them.

Thanks,

Posted: Thu Apr 21, 2005 5:42 pm
by Steve
Peice of cake. Obsoive:

TO SAVE STRING:

Open "string.txt" as A%s
Print A%s "A"
Close "string.txt"

TO OPEN STRING:
Open "string.txt" as B%s
Print A%s


OR something like that... Check out qbasic.com tutorial 3!

Posted: Thu Apr 21, 2005 8:22 pm
by mundofr
hehe :lol:
can u explain it better? wat does the "%" symbol means???

Posted: Fri Apr 22, 2005 5:11 pm
by Rattrapmax6
Um,. off the top of my head...

Saving to a file...

Code: Select all

OPEN "Filename.txt" FOR OUTPUT AS #1
PRINT #1, A, B, C, D, E
CLOSE #1
Reading saved info...

Code: Select all

OPEN "Filename.txt" FOR INPUT AS #1
INPUT #1, A, B, C, D, E
CLOSE #1
Like that,.. :wink:

Posted: Sat Apr 23, 2005 8:55 pm
by {Nathan}
For once people are lazy-ing me... most of the time they unlazy me.... :?