in reply to Convert binary file to ascii
Once you've read the data from the binmoded file, use this:
Update: added join for commas.
print join ',', map{ sprintf '0x%04x', $_ } unpack 'v*', $bin;; 0x0002 0x0000 0xfff7 0xfff4
Depending which way you're going big- to little-endian or vice versa, you might need to swap 'v*' for 'n*'. See pack for details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Convert binary file to ascii
by richz (Beadle) on Jun 22, 2007 at 19:13 UTC | |
by BrowserUk (Patriarch) on Jun 22, 2007 at 19:38 UTC | |
by ikegami (Patriarch) on Jun 22, 2007 at 19:30 UTC | |
|
Re^2: Convert binary file to ascii
by richz (Beadle) on Jun 22, 2007 at 19:24 UTC | |
by BrowserUk (Patriarch) on Jun 22, 2007 at 19:42 UTC | |
by richz (Beadle) on Jun 22, 2007 at 19:50 UTC | |
by BrowserUk (Patriarch) on Jun 22, 2007 at 20:12 UTC | |
by richz (Beadle) on Jun 22, 2007 at 20:25 UTC |