what's the sizeof...unpack('H or h or B or b ? 
Author Message
 what's the sizeof...unpack('H or h or B or b ?

i have a data file that i need to modify.  here are some lines from xdump:
00000000    00000000 00000000 00000000 00000000    ................
00000010    0000f333 41349a33 41340f34 7b33b733    ...3A4.3A4.4{3.3
00000020    3e35f134 cb347534 5c35a034 0f341234    >5.4.4u4\
00000030    b733c933 df34b334 b334e534 70344134    .
00000040    8b349434 94349434 0435f134 92354d35    .
00000050    bf352d35 f134f134 2d353e35 3e353e35    .5-5.4.4-5>5>5>5
looks to me that the bytes are in the wrong order, that is, instead
of F333(62,259 dec), the pattern should be 33F3(13,299 dec).

  foolish me, i thought dd would swab the bytes.

i have been trying to use the source of xdump to do this byte swapping,

i can pull apart each original value (F333):

     while (($len = read(STDIN,$data,2)) == 2) {

seems to work, but have not been able to break apart this n value.

also, it looks to me, that the while line is grabbing two full bytes,
yet, i seem to be able to use unpack('n'  to isolate each value.

any info?

roger hubbard

Geography-Geology Department
University of Nebraska at Omaha

Sat, 15 Mar 1997 22:31:23 GMT  
 [ 1 post ] 

 Relevant Pages 

1. `du -bs $dir` question

2. XSUB, .bs, PDF, FDF

3. Size of Tk.bs file in auto directory

4. unpack('x10','')

5. sizeof($), sizeof(@), sizeof(%)

6. bug in 'unpack'?

7. Help with unpacking 'little endian' integers

8. Help with unpacking 'Little endian' integers

9. pack, unpack and 'w'

10. bug in 'unpack'?

11. Problem With Unpack('u')

12. strange warning with unpack('u',...)


Powered by phpBB® Forum Software