Loading ...
Sorry, an error occurred while loading the content.

47390Re: [LIBERTYBASIC] Binary File Question

Expand Messages
  • gfcanida@yahoo.com
    Mar 7 6:43 PM
    • 0 Attachment
      Fred,

      Change print #O, fpos;": ";c$
      to print #O, fpos;": ";c$;" ";len(byte$)

      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