ReadByte problems

Blitz3D Forums/Blitz3D Programming/ReadByte problems

weebo(Posted 2007) [#1]
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


big10p(Posted 2007) [#2]
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. :)


weebo(Posted 2007) [#3]
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
*************************


weebo(Posted 2007) [#4]
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.


Gabriel(Posted 2007) [#5]
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.