-
I try to open a binary file by using code:
open "a.bin" for binary as #1
while not eof(1)
msgbox (asc(input (1, #1))
wend
close(1)
but I found that, most of the value print out was 0 (what it should be like 254, 238, 221 etc, but the value 255 was able to print out!), I don't know why, could someone able to help me?
-
That method only works with ascii files.
I fixed your code to work with binary files. Fully commented.
The new code can be found at http://agent_153.tripod.com/binary.html
-
Ouch....
Use a byte array!
"Get" the whole lot to a dynamic array of bytes. Then if you want to look at them loop through them as you like
-
Thanks for the input, paul. I think that would make the code bigger, but the file would only need to be open while filling the array. I'll write a second routine that does it that way and then benchmark it.