"Goudar, Girish" <Girish.Goudar@goodrich.com> writes:
Thanks for the quick reply. I can use the struct module at Python side and use the pack() function to pack the data. But in the DEOS side I need to unpack the data for that I need to use unpack() function. But DEOS is not supporting unpack() function. What to do?
I meant to use that you can use struct.pack to create data that can be interpreted as a structure defined in C, assuming the same architecture is run on both machines. Such sharing of data is one of the use cases of the struct module. For example:
# python side: import struct s = struct.pack('cid', 'A', 10, 20.0) send_data_to_network(s)
/* C side: */ struct data_desc { char c; int i; double d; };
char *s; struct data_desc data;
s = read_data_from_network(); memcpy(&data, s, sizeof(data)); /* data.c is now the char data.i the int data.d the float (double) */
Hi
This is working file. Thanks.
-----Original Message----- From: Hrvoje Niksic [mailto:hniksic@xemacs.org] Sent: Friday, February 26, 2010 10:42 PM To: Goudar, Girish Cc: capi-sig@python.org Subject: Re: [capi-sig] (no subject)
"Goudar, Girish" <Girish.Goudar@goodrich.com> writes:
Thanks for the quick reply. I can use the struct module at Python side and use the pack() function to pack the data. But in the DEOS side I need to unpack the data for that I need to use unpack() function. But DEOS is not supporting unpack() function. What to do?
I meant to use that you can use struct.pack to create data that can be interpreted as a structure defined in C, assuming the same architecture is run on both machines. Such sharing of data is one of the use cases of the struct module. For example:
# python side: import struct s = struct.pack('cid', 'A', 10, 20.0) send_data_to_network(s)
/* C side: */ struct data_desc { char c; int i; double d; };
char *s; struct data_desc data;
s = read_data_from_network(); memcpy(&data, s, sizeof(data)); /* data.c is now the char data.i the int data.d the float (double) */
participants (2)
-
Goudar, Girish
-
Hrvoje Niksic