IO problems?

ANOQ of the Sun
Thu, 01 Jun 2000 21:41:04 +0200


I seem to have problems reading a file with
BinIO in MLTon (at least under Win32):

When I open a file with:

val inStr = BinIO.openIn "somefile"

And then call:

val vec = BinIO.input inStr

I get a vector of 222 bytes - this
is OK... but if I call input again
on the same file a get a vector of 0
bytes - which should be like end of file.
But the file is several kilobytes long.

If I use this instead

val vec = BinIO.inputN (inStr, 222)

I get the same behaviour.

If I use

val vec = BinIO.inputN (inStr, 200)

and call this 3 times I get:
200 bytes, 22 bytes and then 0 bytes.

Have you experienced this before or
do you know what it might be?
It seems like some internal buffer
which is not getting updated.

I know that I was the one to both port
to Win32 and to implement BinIO - but
I'm still not sure if the problem has
anything to do with what I did :)

BinIO was (if I remember correctly) mostly
just a copy of TextIO with some modified
flags on open. So if the problem is in
BinIO I'm sure it's also in TextIO.

And running on windows shouldn't
be much different. I haven't tried
under Linux, because MLTon does not
work for native compilation any more
on my Linux system after I upgraded to
libc6.1 (glibc2.1 or whatever).
Not even after recompiling MLTon.
This is another problem that I'm
currently having with MLTon by the
way. I can compile just fine, but the
resulting executables just segfaults.
The exact same problem is present
in MLKit3 by the way - and it also
generates C-code and calls GCC like
MLTon. However my GCC compiler seems
to work just fine for ordinary C

Of course it might all just be
my Linux system.
In "The Unlimited Game" I was able
to read a 388 byte highscore-file
with BinIO - and it was compiled on
my old system with libc6.0 before
I upgraded.

Any hints of any kind?