writing numbers in binary file

Terry Reedy tjreedy at udel.edu
Mon May 31 13:23:15 EDT 2010


On 5/31/2010 12:43 PM, eskandari wrote:
> On May 31, 12:30 pm, MRAB<pyt... at mrabarnett.plus.com>  wrote:
>> eskandari wrote:

>> Use the 'struct' module to convert the int to a bytestring, and remember
>> to open the file as a binary file.
>
> Thanks alot,
> I have an question, if I do so, Will the second program (C++ program)
> which process this file, encounter any problem while parsing the file?
> It find number of integers by filelen/4 and ..... (It assumes that
> file was created as the same way which C++ does)

Tim Chase pretty well answered this. If you are not familiar with the 
problem of 'endianess', see
http://en.wikipedia.org/wiki/Endianess




More information about the Python-list mailing list