Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TAB ON EVERY INSTANCE OF SPACE

Status
Not open for further replies.

IncredibleVolk

Technical User
Apr 2, 2004
67
0
0
US
I took this script off this site. It's logic appears correct but I'm getting a "value out of range" error. I have multiple columns I need to delimit and I wonder if it's because the total exceeds 256 characters


fopen 0 sTabName READ
while not feof 0
fgets 0 sLine
strlen sLine iLen
for iLoop = 0 upto iLen-1
strgetc sLine iLoop iChar
if iChar == 32
iFlag = 1
strputc sNewLine iPos iChar
else
if iFlag == 1
strputc sNewLine iPos 9
iPos++
strputc sNewLine iPos iChar
iFlag = 0
else
strputc sNewLine iPos iChar
endif
endif
iPos++
endfor
endwhile
fclose 0
 
A string is limited to holding 256 characters like you mentioned.

If your data file contains more then this number per line, then consider using fgetc (inputs one character at a time.)

You would have to loop through each line, building the data for each column in a temp variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top