>>I have an application that creates data on another platform than Linux
>>and when we read these datas on the linux box, we have to work on the
>>order of the bytes by eight block count. Is there a mean to do the work
>>automatically by options on the opening of the file ? where can i find
>>answers on this subject ?
>(1) It's not "indian", but "endian", the "end" part referring to
>those people who open their boiled eggs at a particular end (yes,
>really!).
>(2) What does "order of the bytes by eight block count" mean?
>(3) Generally speaking, reversing endian-ness has to be done by
>individual programs. While it is true that X servers cater for
>different endianness of the client computer, other programs seem not
>to do so. So you are probably on you own in this. However, here is a
>procedure to reverse endianness of integers:-
If I were you, and I wanted to do portable binary stuff
(there's an oxymoron), I'd always write things in "network
order". There are already macros available to convert between
host and network byte order: ntohs(), ntohl(), htons(),
htonl(). These macros get used a _lot_ in network stacks and
are probably as optimal as you can get. Unfortunately, they're
only available for "short int" and "long int". Network geeks
don't care about floats and doubles (or long long ints,
apparently).
Way back when, Mark Williams Co. used to sell a v7 clone called
Coherent which ran on various processors (8086, 68K, etc.).
They had a patent on storing data on disk in a standard byte
order. So, if you write data to disk in network order you owe
them royalties -- perhaps it's expired. I don't know that they
ever tried to enforce it, and MWC is, I believe, out of
business anyway.
--
Grant Edwards grante Yow! YOW!!! I am having
at fun!!!
visi.com