Robert Epprecht wrote:
> I guess, that  key?-file ( wfileid -- flag )  should return TRUE if
> it is possible to read at least one byte from the file. Is this right?

Yes.

> Is there a special treatment of an input
> byte with value zero?

There should not be; I do not see any special treatment in the source
code, and testing reading from a disk file has revealed no special
treatment, either.

> It looks to me as if key?-file would sometimes return FALSE even when
> there *is* a byte with value zero at /dev/midi. From this point on
> key?-file would always return FALSE even if I send other (non zero)
> bytes through the MIDI input to /dev/midi.
> 
> I used all my debugging tricks to find the flaw in my program, but
> wasn't able yet to find the bug...

Does this also occur when you read from a regular file?  If so, please
make the file and some test code available.

BTW, in testing I have found a bug in KEY?-FILE; if I successfully
KEY?-FILE from a regular file, and then KEY-FILE from somewhere else
(e.g., stdin), the latter gives me the character from the file.  This
comes from using a global variable "pending" to remember the character
that was read in, instead of having one per file.

The clean way to solve this would be to check if there is already a
character buffered by the FILE * structure, and if not, try to read
it, and then ungetc() it.  Unfortunately, I don't know a portable way
to determine that there are buffered characters in a FILE *.

- anton


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to