|
-
Jun 1st, 2000, 12:15 PM
#1
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?
-
Jun 1st, 2000, 01:06 PM
#2
Fanatic Member
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
-
Jun 1st, 2000, 07:06 PM
#3
Fanatic Member
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
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Jun 2nd, 2000, 01:25 PM
#4
Fanatic Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|