Re: How to make binary data portable?
- From: Randy Howard <randyhoward@xxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 18:47:39 GMT
On Thu, 30 Jun 2005 12:39:47 -0500, PengYu.UT@xxxxxxxxx wrote
(in article
<1120153187.779372.187600@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>):
>
>
> Martin Ambuhl wrote:
>> PengYu.UT@xxxxxxxxx wrote:
>>> Hi,
>>>
>>> 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. You will find that when transporting data from one
>> implementation|platform to another you still need to consider whether
>> you need to convert that data.
>
> Is there any easy way to convert the data?
Define 'easy'.
You could just write it all out as ASCII text, using a known
format, then read it in and convert it based upon that format.
The short example you used only involved an int, so it's pretty
simple. What are you really trying to do?
Or you could use something like XML if you have managers around
that like buzzwords.
--
Randy Howard (2reply remove FOOBAR)
.
- References:
- How to make binary data portable?
- From: PengYu.UT@xxxxxxxxx
- Re: How to make binary data portable?
- From: Martin Ambuhl
- Re: How to make binary data portable?
- From: PengYu.UT@xxxxxxxxx
- How to make binary data portable?
- Prev by Date: Re: why use -> (not .) with pointers?
- Next by Date: Re: why use -> (not .) with pointers?
- Previous by thread: Re: How to make binary data portable?
- Next by thread: Re: How to make binary data portable?
- Index(es):
Relevant Pages
|
|