Carriage return / line feed issue

Hi all.

Need help with something.

I am reading in a text file, and it has a bunch of lines (529 to be exact). When I do this:

while NOT tis.EndOfFile
stringHoldingFromFileRead = tis.ReadAll
lineCount = lineCount + 1
window1.TextArea1.Text = stringHoldingFromFileRead

It fills in the TextArea, but only shows as 1 long line… which makes sense.

I WANT to read in one line at a time, so I go:

while NOT tis.EndOfFile
stringHoldingFromFileRead = tis.ReadLine
lineCount = lineCount + 1
window1.TextArea1.Text = stringHoldingFromFileRead

It just gives me ONE long line. I have tried

stringHoldingFromFileRead = tis.ReadLine + EndOfLine.CRLF
stringHoldingFromFileRead = tis.ReadLine + EndOfLine.Windows
stringHoldingFromFileRead = tis.ReadLine + chr(13+chr(10)

But I always get ONE Long Line in my textArea.

I opened my file and showed non-printing characters and it gave me the “backwords P” symbol, so just for giggles I even tried the following

stringHoldingFromFileRead = tis.ReadLine+chr(244)

Anyone see what I am doing wrong?


There is a command to set the correct EndOfLine:

result=ReplaceLineEndings (SourceString, LineEnding)

That was it Mr. Schwarz: If we ever meet in real life, I’ll buy you a coca-cola. Or if you are Canadian, I’ll buy you a beer!



You’re welcome.

You can also do:

result = SourceString.ReplaceLineEndings( LineEnding )

and you can replace the line endings with anything you’d like, including nothing.

And the really sad thing is I am SURE someone told me this before.
Old age…

You are not alone.

Old stuff is still here, but acquiring new things (remember new things) is diffictult, very difficult.

Ah, I love being old technology… :smiley: