Documentation cut and paste error for byte input?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Documentation cut and paste error for byte input?

emacstheviking

8.13  Byte input/output

These built-in predicates enable a single byte to be input from and output to a binary stream. -1 is returned to indicate the end-of-file.


How do I know the difference between 0xFF and the end of file then?  I looked at 8.12 and it looks like it might just be a cut and paste thing going in there.

Sean.



_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog
Reply | Threaded
Open this post in threaded view
|

Re: Documentation cut and paste error for byte input?

"Micha� Bieli�ski"
Dnia 23 Listopada 2013, 15:15, So, Sean Charles napisał

> 8.13  Byte input/output
>
>
> These built-in predicates enable a single byte to be input from and output
> to a binary stream. -1 is returned to indicate the end-of-file.
>
>
> How do I know the difference between 0xFF and the end of file then?
> I looked at 8.12 and it looks like it might just be a cut and paste
> thing going in there.

Note that the above says byte input, not byte return type.  I think it is
the same as getc() in C.  It reads bytes but returns larger integer to
facilitate signaling end of file.

Under these assumptions 0xFF would be 255, not -1.

--
Michał Bieliński


_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog
Reply | Threaded
Open this post in threaded view
|

Re: Documentation cut and paste error for byte input?

emacstheviking

>
> Note that the above says byte input, not byte return type.  I think it is
> the same as getc() in C.  It reads bytes but returns larger integer to
> facilitate signaling end of file.
>
> Under these assumptions 0xFF would be 255, not -1.
>

Yes, but in byte mode, 0xFF is a valid byte…..I still think it is a documentation problem, it’s the classic “rogue value” problem.


_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog