Migration of data file in Unix to linux
We planned to migrate data files in Unix to Linux. The file in Unix is in big endian data format where is linux is configured as little endian byre structure. This is causing problem in data computation.
Can any help How data can be ported to linux ( converting big endian to little endian). How linux configured can be configured for big endian byte structure. |
Quote:
C++ General: How do I convert between big-endian and little-endian values? ciao, jdk |
You could use the functions in arpa/inet.h to convert from host to network byte order, and back from network to host. Note that this is dependent on the length of the integer.
I don't know of any way to convert an arbitrary file, since a program that did that wouldn't know how the data is organized in the file. The inet.h also doesn't appear to have functions for 64-bit integers or floating point numbers, if that is an issue for you. You might also want to look at http://www.codeguru.com/forum/showthread.php?t=292902. Edit: jkdaye beat me to it. |
If you simply need to swap bytes, then 'dd' with the 'conv=swab' option is a possibility.
|
All times are GMT -5. The time now is 09:16 PM. |