IncredibleVolk
Technical User
I don't have a good understanding of file manipulation using aspect and I was hoping someone could help. I'm determining the length of each line in a text file. If the length is longer than 12 characters, I want to insert several spaces at the start of the line. I basically want to push the data on that line to the right. For some reason I don't seem to be returning to the beginning of each line. It's cutting characters off the line(s) with 12 or fewer characters and those are the lines I want to stay put.
string sLine,Join
string sSpaces = " "
if fopen 0 "C:\CAPTURE.TXT" READWRITE
while not feof 0
fgets 0 sLine
strlen sLine iLen
lLen = iLen
if lLen < 12
iFlag = 1
else
if iFlag == 1
strfmt sJoin "%s%s" sSpaces sLine
fseek 0 (-lLen) 0
fputs 0 sJoin
ftell 0 lLen
endif
endif
Counter ++
endwhile
fclose 0
endif
endproc
string sLine,Join
string sSpaces = " "
if fopen 0 "C:\CAPTURE.TXT" READWRITE
while not feof 0
fgets 0 sLine
strlen sLine iLen
lLen = iLen
if lLen < 12
iFlag = 1
else
if iFlag == 1
strfmt sJoin "%s%s" sSpaces sLine
fseek 0 (-lLen) 0
fputs 0 sJoin
ftell 0 lLen
endif
endif
Counter ++
endwhile
fclose 0
endif
endproc