writing binary file for different platform

Erno Kuusela erno-news at erno.iki.fi
Fri May 10 09:09:12 EDT 2002


In article <3cdbc406.16463125 at news.easynews.net>, stojek at part-gmbh.de
(Marcus Stojek) writes:

| Now I have to prepare such a binary file on my Win system that will
| be read on an IBM machine (IBM AIX 4.3.3.25)

| From the doc I guess that I have to add a character to the format
| string (e.g. '<' or '>' ). If this is correct then please could
| someone tell me which one. If not then what else can i do ?

with luck, the endianness character could make it work. but
different platforms have different data type sizes, different
floating point number formats and different alignment rules.
so generally, you cannot do it with the struct module.

you will therefore probably need to use a platform independent
format for transferring data between your programs, such as text.

   -- erno



More information about the Python-list mailing list