Python does have struct module that allows you to create
C-style structures.

Googling for "python struct" give us:

http://docs.python.org/lib/module-struct.html

I use it a lot to interface to COM object and to call
methods in .DLLs.

Larry Bates


Gijs Korremans wrote:
> Hi,
> 
> I want to connect to a com object with win32.client.
> Through this com object a have to connect to an other device with 
> object.Connect(struct IPADDRESS_STRUCT * ip)
> 
> the struct IPADDRESS_STRUCT looks like this:
> 
> Byte Offset   Name    Type    Length (Bytes)  Description
> 0     b1      BYTE    1               Byte 1 of an internet address
> 1     b2      BYTE    1               Byte 2 of an internet address
> 2     b3      BYTE    1               Byte 3 of an internet address
> 3     b4      BYTE    1               Byte 4 of an internet address
> 
> Because Python doesn't have structs like C, I tried to do it with a class (C 
> structs are classes with no private) and with pack but I always get the error 
> message "Only com_record objects can be used as records"
> 
> I'm new in the python language but I couldn't find anything about structs or 
> com_records in python on the internet.
> 
> Does anyone know how to do this? 
> 
> Kind regards, 
> 
> 
> Gijs
> 
> --
> This message has been scanned for viruses and
> dangerous content by Network Sentry, and is
> believed to be clean.
> http://www.networksentry.co.za
> 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to