AllExperts > Qbasic, Quickbasic 
Search      
Qbasic, Quickbasic
Volunteer
Answers to thousands of questions
 Home · More Qbasic, Quickbasic Questions · Answer Library  · Encyclopedia ·
More Qbasic, Quickbasic Answers
Question Library

Ask a question about Qbasic, Quickbasic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Alex Barry
Expertise
I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.

Experience
Hobby programming since 2000

I no longer belong to any community programming groups, but do have knowledge of *basic dialects and C/C++

 
   

You are here:  Experts > Computing/Technology > Basic > Qbasic, Quickbasic > Qbasic line splitting, filtering program

Qbasic, Quickbasic - Qbasic line splitting, filtering program


Expert: Alex Barry - 5/3/2009

Question
Can QBasic be used to read in (or filter) a text (.txt) file that has more that 256 comma delimited values per line and create a output text file that contains the 1st 256 values and a 2nd file containing the next 256 values (that are on the same line) and so on?  These separate files would then be imported into MS Access.  Each line in the text file is formatted as "data1","data2","data...", often beyond 256 data values per line and each line is unique such as the first line contains data information for device 1, the next line has data info for device 2 and so on.  Programming is not my "day" job but I have some experience and just need ideas on how to approach this programming project.  Can provide more/better info if needed.  Thanks

Answer
Hi, Don,

I think you would want something like this:

DIM i AS INTEGER
DIM l AS INTEGER
DIM d AS INTEGER  ' **** Change this datatype to match whatever type your getting from the file
OPEN "master.data" FOR INPUT AS #1
l = 1
DO UNTIL EOF( 1 )
 OPEN "line" + STR$( l ) + ".txt" FOR OUTPUT AS #2
 FOR i = 1 TO 256
   INPUT #1, d
   PRINT #2, d,
 NEXT i
 PRINT #2, ""
 CLOSE #2
 l = l + 1
LOOP
CLOSE #1

I think that would do the trick, or at least get you pointed in the right direction.

Take care,
-Alex

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.