ReadByte problems

Blitz3D Forums/Blitz3D Programming/ReadByte problems

Hello,

A simple problem perhaps someone can shed some light on.

I am reading a file using readbyte.

Trouble is, whenever the file contains hex "00" instead of reading "00" it reads "20". "20" is read as "20".

How can I get readbyte to behave and read what is in the file?


I am simply using: read1 = ReadByte( filein )

Many thanks

Can you post some code?

Are you sure you're writing the file correctly in the first place?

If this was a bug, I'm pretty sure someone would have spotted it before now. :)

ok well here is a simple example. To check it I am comparing the output on the screen with the contents of the test.jpg file in a hex editor. Everything is read correctly, except 00 (or "00000000") is read as 20 (or "00000020").

************************
filein = ReadFile("C:\test.jpg")

While Not Eof(filein)

read1 = ReadByte( filein )
Print(Hex$(read1))
waitkey()

wend
*************************

Hmm...I take it back, in writing this small test program I have found it displays correctly.

There must be something odd about my other program.

Excuse me while I slap myself.

Are you sure you're not expecting a 00 where you actually have a space? A space is 32 in ascii, which would be 20 in hex.