Converting from long integer to read-only buffer

Ben Andrew Fulton bafulton at cats.ucsc.edu
Tue Jul 3 22:57:32 EDT 2001


I'm currently working on a module to control a piece of hardware over the
serial port of a Mac. The command packets are currently manipulated within
the the module as long integers so that I can twiddle individual bits. 
However, when I send them out the serial port they need to be converted
into a read-only buffer (or perhaps a string [although of course, str() 
is not the answer]) for the ctb (communications toolbox) to accept them.
Is there a module out there that can do a straight long int --> read-only
buffer conversion? struct, array, and binascii all seem inadequate to the
task unless I write my own helper function, which I suppose I will have to
if I can't figure anything else out in the next day or so. 

Thanks,

-->ben fulton




More information about the Python-list mailing list