I've just finished a course in Qbasic at school, and we worked with external files. Now you can use external files to keep track of a person's score right, but what if you had multiple people and wanted them to all be included one the scoreboard and external file. Say I had this
"Player1",500
"Player2",300
"Player3",600
Alright, now since I got that, and Player2 decides to play again, how can I edit that specific record from QBasic without messing up the file? Or can you just not do it?
Maybe I'm just not looking hard enough...
-
- Newbie
- Posts: 2
- Joined: Mon Jan 21, 2008 9:57 am
Re: Maybe I'm just not looking hard enough...
Typically, you rewrite the file.ConfusedAboutFiles wrote:how can I edit that specific record from QBasic without messing up the file
1) Read the file into arrays in your program. Now you don't need the file any more.
2) Update any "records" you please by changing array values.
3) Re-create the file by writing all the info in the arrays.
Mac
-
- Newbie
- Posts: 2
- Joined: Mon Jan 21, 2008 9:57 am