Re: How to make binary data portable?





Walter Roberson wrote:
> In article <Q1Wwe.14054$pa3.837@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> Martin Ambuhl <mambuhl@xxxxxxxxxxxxx> wrote:
> >PengYu.UT@xxxxxxxxx wrote:
> >> I write the content of a in file "data" (in Sun Machine). Then I read
> >> "data" in both SunOS and linux. But the result is different. Do you
> >> know how to make it binary data portable.
>
> >Binary numeric data is inherently not portable. If you want files to be
> >portable, your best bet is to write numeric data as text. Even that
> >assumes that the different implementations|platforms use a common form
> >of encoding text.
>
> The "xdr" library (which is NOT part of the C standard itself) was
> written to try to deal with these issues. "xdr" stands for
> "external data representation". It is commonly used for
> Remote Procedure Calls, so it is available for a wide variety
> of systems.
>
> I seem to recall that the xdr folk got around to extending xdr to
> work with 64 bit values, but I am not sure how widely those extensions
> got implemented.

Do you have a rough idea how much performance will be lost using xdr
instead of using native representations, when I don't have to use xdr?

.