BarryG,
a byte is represented by 8 bits. In RAM memory, these are (simply spoken) 8 transistors that store either state 1 or 0.
There is no 9th transistor for the sign, so it is only a mutual agreement on how to read or display the contents of these 8 bits (= 1 byte).
A signed byte covers the range -128 to +127
An unsigned byte covers the range 0 to 255.
However, these bytes are not stored differently in the 8 bits, only their meaning is different for us humans:
Unsigned:
00000000 (Bits) = 0 (Byte)
10000000 (Bits) = 128 (Byte)
11111111 (Bits) = 255 (Byte)
Signed:
00000000 (Bits) = 0 (Byte)
01111111 (Bits) = +127 (Byte)
10000000 (Bits) = -128 (Byte)
11111111 (Bits) = -1 (Byte)
You can see that the values for 255 and -1 are identical in the binary system (11111111). Since a hex editor is rarely expected to display signed hex numbers, you will find only 255 for the -1, of course. But in the file on your hard disk, bytes 255 and -1 are completely identical. It only depends on whether you want to understand an unsigned or signed byte.
Since ReadByte() interprets a byte as an unsigned byte, it cannot return -1. Wait, yes, it can, but it looks like this: 255
Kurzer
PS: Try it for yourself with the Windows Calculator in "programmers" advanced mode.
