Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Read Write Issues

Status
Not open for further replies.

Joshshofstahl

Technical User
Jun 14, 2007
1
US
Okay this may seem trivial to most but I'm writing a program that will keep track of completed tasks and invintory but when i use the open command i can get it to create the file and input data but as soon as i goto run the program the second time it dosent add more data it replaces the old data with new. this program Primary reason is to keep track of where invintory is and what the technician will be paid for ve all the other job. i have all the other neccessary information i need but the data management. How do i keep an ongoing file of data for different sessions of the program?
 
When writing, open the file in mode APPEND, e.g.

OPEN "INVENTORY.TXT" FOR APPEND AS #1
 
The Append assumes you always want to add (only) never update or delete anything.

If you want the latter, you should open your file as input and open another file for output. When finished. close and then kill the original and rename the work file.
 
I haven't done anything in Qbasic but would suspect that inventory tracking would be better handled with a random file type if it is available. And possibly as a linked list type file with pointers to individual records so you can add, delete, and modify easily.


Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top