## 47389Re: [LIBERTYBASIC] Binary File Question

Expand Messages
• Mar 7, 2014
• 0 Attachment
Fred,

I looked at the asc and read this :

Print asc( "" ) produces: 0

The input reads up to the end of record excluding the end of record
character.

So when you reach 0A, 0D or 11 byte\$ gets = to "" which translate to hex 00
!

Hope this helps, let me know.

Guy.

-------Original Message-------

From: Fred Jensen
Date: 3/8/2014 00:42:30
To: libertybasic@yahoogroups.com
Subject: [LIBERTYBASIC] Binary File Question

I have a binary file that I want to read sequentially, one byte at a
time. My code is:
----------begin code
nomainwin
open "Binary.txt" for output as #O
filedialog "Open File", "*.*", filename\$
open filename\$ for binary as #I
l=lof(#I)
fpos=loc(#I)
print #O, "Length=";l;" Pos: ";fpos
while fpos<l
seek #I, fpos
input #I, byte\$
c\$=dechex\$(asc(byte\$))
print #O, fpos;": ";c\$
fpos=fpos+1
wend
close #I
close #O
end
-----------end code

This is just a little test program to try and figure out what's
happening. It is supposed to read one byte, convert it to hex, then
print the byte# and and the byte in hex to an output file and repeat for
each byte in the file [around 5,800 or so]. By and large, it seems to
work however a 0x0D byte gets translated to 0x00, a 0x0A to 0x00 and
0x11 also becomes 0x00.

Can someone point me toward what I've missed here [I know I've missed
something]

Thanks

Fred K6DGW
Auburn CA USA

[Non-text portions of this message have been removed]
• Show all 7 messages in this topic