Computing.Net > Forums > Disk Operating System > Reading tab-delimited files

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

Reply to Message Icon

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.



Sponsored Link
Ads by Google

Response Number 1
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!


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Reading tab-delimited files

Attempting to read an ini file. www.computing.net/answers/dos/attempting-to-read-an-ini-file/13534.html

read multiple variable from file to batc www.computing.net/answers/dos/read-multiple-variable-from-file-to-batc/7436.html

reading a file from a batch file www.computing.net/answers/dos/reading-a-file-from-a-batch-file/765.html