[BUG] Reading Floats from CrLfFileStream (Windows only)

Pennell, David DPennell at quallaby.com
Sun Jul 9 18:04:36 UTC 2000


 If the you read a line that looks like:

1.234

using Float>>readFrom: aCrLfFileStream
and it is on DOS/Windows, you will get
1.0234.

This happens when it tries to read the remainder,
hits the end of line, and tries to #skip: -1.
Because the end of line is 2 characters on DOS,
the stream is positioned one character too far.

I can certainly workaround this, but a general
solution isn't obvious to me.  #skip:
calls #position:.  Changing #position: to be
semantically equivalent across FileStream and
CrLfFileStream seems overkill.  How do other
dialects deal with positioning on variable
width character streams?  Should we just add
a new moveBackOne method for use by peek?

-david





More information about the Squeak-dev mailing list