endian issues 
Author Message
 endian issues

Hi,

I am thinking of using perl to manipulate some binary files. I will want
the script to run on both big and little endian machines. I will be
using "print/read" and "pack/unpack".

The files will always be in network(big-endian) byte order.

Is there something like ntoh (network to host conversion for 16 and 32
bit quantities) or do I need to implement this myself?

Thanks in advance for any info.

-GSM
--

                                                                -GSM
-----
 Giovanni S. Marzot

 Wellfleet Communications
 Network Management Development



Sun, 23 Nov 1997 03:00:00 GMT  
 endian issues

Quote:

>I am thinking of using perl to manipulate some binary files. I will want
>the script to run on both big and little endian machines. I will be
>using "print/read" and "pack/unpack".
>The files will always be in network(big-endian) byte order.
>Is there something like ntoh (network to host conversion for 16 and 32
>bit quantities) or do I need to implement this myself?

Consider the "n" and "N" formats for builtin functions pack() and
unpack().

-- SP



Sun, 23 Nov 1997 03:00:00 GMT  
 endian issues

: Is there something like ntoh (network to host conversion for 16 and 32
: bit quantities) or do I need to implement this myself?

Look up "n" and "N" under pack/unpack.

Larry



Mon, 24 Nov 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. endian issues with DES on solaris

2. endian issues with DES on solaris

3. Converting UTF-16 string from big-endian to little-endian

4. little-endian convert to big endian

5. big-endian to and from little-endian (novice pack/unpack question)

6. Converting UTF-16 string from big-endian to little-endian

7. differentiate btw big-endian machine and small-endian machine

8. Big-Endian to Little-Endian

9. Little Endian vs. Big Endian

10. And in Perl (was Re: Suns Big-Endian or Little-Endian ?)

11. Big-Endian <--> little Endian conversion?

12. floats and endian-ness in perl

 

 
Powered by phpBB® Forum Software