|
Post by Piperlester on May 12, 2004 19:42:36 GMT -5
I'm trying to find out how to store the data as a CSV, I'm writing a client tracking program for my dad's company, and currently I have to DIM all the variables as strings and give them a length, this makes for a difficult time trying to work with all the data, because it's always having extra spaces at the end, making it just a pain in the butt. I have all the inputs down, but to get the inputs into a CSV seems to keep tripping me up... any help would be gladly appreciated. Thanx btw... got the files, and now I'm using Bisray.com
|
|
|
Post by brisray on May 12, 2004 21:41:19 GMT -5
Try this, it was adapted from the QBasic help file.
CLS OPEN "c:\list.txt" FOR OUTPUT AS #1 DO INPUT " NAME: ", Name$ INPUT " AGE: ", Age$ WRITE #1, Name$, Age$ INPUT "Add another entry"; R$ LOOP WHILE UCASE$(R$) = "Y" CLOSE #1 'Print the file to the screen. OPEN "c:\list.txt" FOR INPUT AS #1 CLS PRINT "Entries in file:": PRINT DO WHILE NOT EOF(1) INPUT #1, Rec1$, Rec2$ 'Read entries from file. PRINT Rec1$, Rec2$ 'Print the entries on the screen. LOOP CLOSE #1
You use WRITE to put data into the file. Write surrounds the text with quotes, adds the commas and each write statement adds a CRLF to the line.
The file is read using INPUT. Like the WRITE statement the variables are written an read one after the other, a line at a time.
Ray
|
|
|
Post by Piperlester on May 13, 2004 9:20:02 GMT -5
Gotcha.. thanx, I see where I was going wrong before, I had been using PUT and PRINT to get data to the files.
I will worship your most knowledgeable fingers ;D
|
|