> I have a file on Linux(little Indian m/c) and written
> some long integer data in file. Now I get this file on solaris
> (Big indian ) m/c (via binary ftp).
> How can I get same data which I have entered on linux on
> solaris m/c?
> Basically I want how to convert little indian m/c file
> to big indian m/c file and vice a versa.
The best way to approach this problem is to store the data in a host
independent form. There are two complementary functions htonl() and
ntohl() which handle unsigned 32-bit data. These functions are typically
used for the transmission of data over a socket but can be used for the
purpose you describe. You would convert the data using htonl() before
writing the data into a file (or a socket) and use ntohl() to extract
the data. If the data have already been written in host (natural) form,
then you'll need to do some byte swapping on the big-endian system.
You can call me a pedagogue if you like but I won't know what you're on