[Newbies] Re: reading lines from textfiles on Linux: solution without an explanation

Charles D Hixson charleshixsn at earthlink.net
Tue May 16 16:06:26 UTC 2006


Chris Kassopulo wrote:
...

OK, I've further adapted your code, thusly:

    | aFile myFile myStream line |
    aFile := 'aising/data/technologies.csv'.
    myFile := (aFile) asFileName.
    Transcript clear.
    myStream := CrLfFileStream fileNamed: myFile.
    [ myStream atEnd ]
        whileFalse: [
            line := myStream upTo: Character cr.  "<<----- Note this change"
            Transcript show: 'line:: '; show: line; cr.
    ].
    Transcript cr; show: 'LineEndConvention = '; show: myStream
    detectLineEndConvention.
    myStream close.
    Transcript cr; show: 'SmalltalkImage current platformName = '; show:
    (SmalltalkImage current platformName).

and now it works properly.  I find this a thorough mystery, as the
original file contained no CR characters whatsoever.  Should I be able
to count on this continuing to work?  Or is this some artifact of a bug
that will be fixed in a later version?  (And it's still claiming that:

    LineEndConvention = lf
    SmalltalkImage current platformName = unix

), which is correct as far as the file on the disk goes, but obviously
doesn't apply to the file as read.





More information about the Beginners mailing list