how many bytes in an int
grante at visi.com
Mon Aug 9 07:34:09 CEST 2004
On 2004-08-09, Reid Nichol <rnichol_rrc at yahoo.com> wrote:
>> I suspect you want to use the "struct" module -- but it's a
>> guess, since you haven't really said what it is you're trying
>> to accomplish.
> I'm thinking of writing a movie file encoder (probably avi).
> So, I need to output DWORD (lookup revealed its a 4-byte int)
> to a binary file. Therefore I need to know whether this can
> be done in python or not, which will tell me whether I'll try
> to do it or not.
> But, since the 64-bit archecture is out, short, long, etc may
> change there meanings quite soon. From what I've read in the
> struct module docs I can only tell it that it's a short, long,
> etc. but not whether it's exactly a 4-byte int. Is there a
> way to do this?
The struct module is the only thing I know about. If you're
worried about the "C" types in the struct module changing
underneat you, you could do a pure Python implimentation of
"python-int" to/from DWORD. It's utterly trivial and shouldn't
take more than one or two lines of code.
Grant Edwards grante Yow! LOOK!!! I'm WALKING
at in my SLEEP again!!
More information about the Python-list