LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2011, 10:12 PM   #1
pandunr
LQ Newbie
 
Registered: May 2011
Posts: 12

Rep: Reputation: Disabled
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.
 
Old 08-11-2011, 12:42 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Quote:
Originally Posted by pandunr View Post
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.
Is this what you want?
C++ General: How do I convert between big-endian and little-endian values?
ciao,
jdk
 
Old 08-11-2011, 12:43 AM   #3
flamelord
Member
 
Registered: Jun 2011
Distribution: Arch Linux
Posts: 151

Rep: Reputation: 34
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.
 
Old 08-11-2011, 01:49 AM   #4
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,661

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540
If you simply need to swap bytes, then 'dd' with the 'conv=swab' option is a possibility.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
server Migration unix to redhat linux mmee Red Hat 5 01-17-2010 11:28 PM
LXer: Encrypt data in Linux/Unix LXer Syndicated Linux News 1 07-01-2009 03:49 AM
Data on Windows to Linux migration tripwire45 Linux - General 8 07-26-2005 05:14 PM
Migration to Linux Software RAID while preserving existing ntfs data ceg4048 SUSE / openSUSE 0 11-27-2004 08:11 AM
Migration d'UNIX vers Linux ou Windows Elise78 Linux - Enterprise 3 06-02-2004 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration