[Newbies] Re: Re: reading lines from textfiles on Linux

Charles D Hixson charleshixsn at earthlink.net
Wed May 17 19:51:20 UTC 2006


Klaus D. Witzel wrote:
> Hi Charles,
>
> on Wed, 17 May 2006 03:21:36 +0200, you <charleshixsn at earthlink.net>
> wrote:
>
>> Klaus D. Witzel wrote:
>>> When you use the Squeak File List
>>> browser (alt-L or ctrl-L with capital L) and view your file and then
>>> in the text pane's context menue ask for 'view as hex', can you
>>> confirm that this Smalltalk program can see and visualize your line
>>> ends?
>> It appears to be 16r10.  I'm not exactly sure, as I'm not used to
>> reading hex this way, so here's the first little part:
>> 16r0 (0)     16r27 16r69 16r74 16r65 16r6D 16r73 16r27 16r9 16r9 16r9
>> 16r9 16r9 16r9 16rA 16r27 16r69
>> 16r10 (16)     16r64 16r27 16r9 16r27 16r6E 16r61 16r6D 16r65 16r27 16r9
>> 16r27 16r63 16r6F 16r73 16r74 16r27
>> 16r20 (32)     16r9 16r27 16r74 16r79 16r70 16r65 16r27 16r9 16r27 16r70
>> 16r6F 16r77 16r65 16r72 16r27 16r9
>> that should include at least one line.  (The first line is the word
>> 'technology'  including the quotes, followed by a line feed.)
>
> This is not output of the File List tool. And there are many 16r9's
> before the line feed and, the word technology is a bit longer than 5
> characters.
>
> ...
>
>> The part that still bothers me is why when I set the mode to ascii (I
>> think that was what I was doing) executing a position: would throw an
>> error.  Also executing a reset.  Also executing a reopen.  (At that
>> point I was operating under the presumption that perhaps
>> detectLineEndConvention was filling the buffer, and then the first read
>> emptied the whole thing, so I was trying to rewind the file to avoid
>> that problem.)  This part no longer exists in any code that I've kept,
>> but it is nagging at me.
>
> Here are two examples, both have the same result, and both do not
> throw an error as you described:
>
> (StandardFileStream readOnlyFileNamed: 'Squeak.ini')next; reset; next;
> reopen; next
>
> (CrLfFileStream readOnlyFileNamed: 'Squeak.ini')next; reset; next;
> reopen; next
>
> You can copy&paste&evaluate with print-it, the file should be the same
> on your machine.
>
> /Klaus
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
Perhaps, but the 16r09's are tab characters, and that is an accurate
description of that part of the file.  Also, now that I think of it
16r10 is the same as 0x0A, or line feed, so that part is also correct.

WRT your examples, I didn't have the problem with CrLfFileStream (once
someone showed me how to use it), and on the StandardFileStream...you
aren't either doing a detectLineEndConvention or setting the mode to
ascii.  You are also using a different command to open the file than I
was using in the commands that I posted.  I may have used that in some
of the experimentation that I did, but not at the time that it was
throwing an error on an attempt to reset.  (Also, position: would
generally be the more useful command, and that was the one that I
initially both experienced the error with AND initially commented on. 
Presumably, however, if reset isn't throwing an error neither is position:.)
Additionally, Squeak.ini doesn't appear to exist on my computer, so I
would expect the commands to fail...but that's just being nit-picky.




More information about the Beginners mailing list