chr 26 in read?

ANOQ of the Sun anoq@hardcoreprocessing.com
Fri, 02 Jun 2000 14:31:15 +0200


Hello!


I have inserted a printf command in
the readArr function (in posix/io.sml):

printf ("readArr, max %d %d\n", max, i)

And I added this in updateIn (in TextIO) after the call to readArr:

val _ = print ("bytes read: " ^ (Int.toString bytesRead) ^ "\n")

Then I have a small test program:

val inStr = TextIO.openIn "Asteroid8A.Lwo"
val vec1 = TextIO.input inStr
val _ = print (Int.toString (CharVector.length vec1))
val _ = print "\n"
val vec2 = TextIO.input inStr
val _ = print (Int.toString (CharVector.length vec2))
val _ = print "\n"
val _ = TextIO.closeIn inStr

The output I get is:

bytes read: 222
222
bytes read: 0
0
readArr, max 4096 0
readArr, max 4096 0

I think it's strange that the readArr output is
last (but it might be printf vs. ML's print)...
but it seems to me that something is wrong
in the primitive posix call to MLTON_read
which calls the C function read.

I have studied the actual bytes in the
actual file I'm reading - and it seems
that byte 222 is char-code 26.
So this might be part of the fault...
And indeed, when I read another file I can
read 837 bytes before it stops and it also
stops at a char-code 26!

In both files the position where it stops
is the first char-code 26 in the file.

Also, I've now upgraded my libc as Henry
has suggested - and now I can compile
natively on Linux with MLTon again!
I upgraded these debian packages:
libc6_2.1.3-8 to libc6_2.1.3-10
libstdc++..<something>..-8 to -12
Also I upgraded the corresponding -dev
packages.

Now, compiling the test-program from
before I get this output when
running on Linux:

readArr, max 4096 0
bytes read: 4096
4096
readArr, max 4096 0
bytes read: 4096
4096

This looks much better - so the
problem must be Windows specific...
Does anybody know what char-code
26 means?


And thanks a lot Henry :)


Cheers
-- 
http://www.HardcoreProcessing.com