Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Reading tab-delimited files
Name: Henk Date: November 22, 2000 at 04:50:48 Pacific
Comment:
How can I read columns with information from a tab-delimitid file with GWBasic? With MID$ in some textfiles columns shift when a previous column gets wider, although one does not see this when one opens the textfile with for example EDIT.
Name: Al Date: November 23, 2000 at 10:19:55 Pacific
Reply:
I suspect the problem is that some of the column data strings are longer than the default tab width. I don't remember there being a way to change GWBasic's tab width so you will have to change it yourself in code:
100 DEFINT A-Z 110 colwidth = 10 120 OPEN "filename" FOR INPUT AS #1 140 WHILE NOT EOF(1) 150 LINE INPUT #1, l$ 160 colpos = 1 170 FOR i = 1 TO LEN(l$) 180 c$ = MID$(l$, i, 1) 190 IF c$ <> CHR$(9) THEN PRINT c$; : NEXT i 200 colpos = colpos + colwidth 210 LOCATE CSRLIN, colpos 220 NEXT i 230 PRINT 240 WEND 250 CLOSE #1
You will have to straighten out the line wraps. Change the columw width at line 110 until it displays correctly.
If this doesn't do it for you it should give you some other ideas to try. Good luck!
Summary: I am creating a batch file which successfully writes a variable into a text file. The file is called, "Count.ini", and it only contains one entry, "Count=343". What I need to learn now, is how to rea...
Summary: would that be microsoft quick basic? different versions of basic may have different string processing ability but an approach like this: OPEN datafile$ FOR INPUT AS #1 OPEN batchfile$ FOR OUPUT AS #2 ...
Summary: Is it possible to open and read a data file from a batch file? I am working on a make batch file and it would be very nice if I could open and process a normal format makefile instead of writing and r...