[gambit-list] input-port-byte-position

John MacFarlane jgm at berkeley.edu
Tue Oct 17 10:07:45 EDT 2006


I'm getting strange behavior with input-port-byte-position.  When used
to read the byte position of an input file, it always returns 0.  On the
other hand, when used to set the byte position, it works as expected.
Here's an example:

% gsi/gsi
Gambit Version 4.0 beta 20

> (define f (open-input-file "README"))
> (input-port-byte-position f)
0
> (read-char f)
#\R
> (read-char f)
#\E
> (input-port-byte-position f)
0
> (input-port-byte-position f 10)
10
> (input-port-byte-position f)   
0
> (read-char f)
#\e
> (input-port-byte-position f)   
0
> 

I've tried following the example in the manual to the letter, and it
still always returns 0.  I've tried this both with 4.0 beta 17 
(installed from a deb) and with 4.0 beta 20 (compiled from source,
passes all tests in "make check"). I get the same results on two
different machines (both i686-gnu-linux).

Does anyone have an explanation for this, or a fix?  Aside from this
problem, gambit-C is perfect for my project.  I noticed that there
is a message in the archives from September 2005 asking the same question,
but no response was posted.  Any help would be most appreciated.

John




More information about the Gambit-list mailing list