Save Function

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Anonymous

Save Function

Post 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,
Steve

Post 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!
User avatar
mundofr
Coder
Posts: 34
Joined: Sat Apr 16, 2005 9:11 pm
Location: IN, USA
Contact:

Post by mundofr »

hehe :lol:
can u explain it better? wat does the "%" symbol means???
<b><i> "Rock is the first thing in life, after rock comes the comp...." Rock on Big M</i></b>
<img src="http://www.freewebs.com/mundofr/bigm2.bmp">
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post 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:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

For once people are lazy-ing me... most of the time they unlazy me.... :?
Image
Post Reply