Qbasic, Quickbasic/QBasic DA files

Advertisement


Question
I often use QBASIC to write custom programs to support my many hobbies.
I created a DA Database file of all the 45-RPM records I have in my collection. Many of the songs and artist names contain a comma.  When reading this file (sequentially, using a FOR statement) to build an index the comma is acting as a CSV character and breaking up the record into smaller pieces, disrupting the alphabetic sequence of the file as well as the logic of the program.  How do I get around this problem?

Record length = 100 (STRING)
File is sorted alphabetically by song title
Trying to build an index array showing beginning record and number of records for each letter of the alphabet.

Answer
if you are using sequential files and are having trouble with the output format then the following tips may help you if you are using random files then i can not help you as i don't have much experience in them.
Hope this helps.
***********************************
if you use code like this

print #1 ,"abc,xyz"

then use

write #1 ,"abc,xyz"
***********************************
if you are using code like this,

print #1 ,"abc,xyz" ,"def,uvw"

then use this

write #1 ,"abc,xyz" ,"def,uvw"
***********************************
simply replace the print with write and the comma seperation will not be a problem.

Qbasic, Quickbasic

All Answers


Ask Experts

Volunteer


mohammad hasnain

Expertise

i have been using QBASIC for about 8 years and i am capable of answering text based problems as i mainly have been using it for non graphical applications ranging from databases ,algorithm design ,simulations(mainly text based rpg fight sequences) and other simple programs.but i will try my best to help by providing as much information as i have.

Experience

i am not a full time programmer but only indulge in it every now and then as i like the concept of making my wife(i.e. my computer) respond to my every whim hahahaha :P

Organizations
capricorn.engineering@gmail.com

Education/Credentials
i am B.E in mechanical engineering and chemical engineering from NED university

©2016 About.com. All rights reserved.