[Seen]ReadByte - cant differentiate between 0 and error

Just starting out? Need help? Post your questions and find answers here.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: ReadByte - cant differentiate between reading 0 and erro

Post by Mistrel »

DarkDragon wrote:
Mistrel wrote:Java works around this by returning an int which is either 0-255 or -1 if the stream has ended.
Yes but its no byte in purebasic. Byte in PB is signed (in Java too, but see the next sentence). In java it reads a byte, but returns an int, not a byte.
Bytes in Java are signed as well. This would work for PureBasic but it would certainly break backwards compatibility.
DarkDragon
Addict
Addict
Posts: 2228
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: ReadByte - cant differentiate between reading 0 and erro

Post by DarkDragon »

Mistrel wrote:
DarkDragon wrote:
Mistrel wrote:Java works around this by returning an int which is either 0-255 or -1 if the stream has ended.
Yes but its no byte in purebasic. Byte in PB is signed (in Java too, but see the next sentence). In java it reads a byte, but returns an int, not a byte.
Bytes in Java are signed as well.
I said exactly that.
bye,
Daniel
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2058
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: [Seen]ReadByte - cant differentiate between 0 and error

Post by Andre »

Can be closed, or does anyone have a specific suggestion for needed Doc changes/remarks?
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply