Array of structs
Rafa Marin Lopez
rafa at dif.um.es
Thu Feb 9 10:07:34 PST 2006
Hi all
I am trying to create an array of structs (C binding). Each struct has
two strings and an integer
I have
const char array_sig[] = DBUS_STRUCT_BEGIN_CHAR_AS_STRING\
DBUS_TYPE_STRING_AS_STRING\
DBUS_TYPE_STRING_AS_STRING\
DBUS_TYPE_UINT32_AS_STRING\
DBUS_STRUCT_END_CHAR_AS_STRING;
char
string2[]="0000000011111111222222223333333300000000111111112222222233333333";
char string1[]="004040404040";
dbus_uint32_t value = 100;
...
dbus_message_iter_open_container(&array_iter,
DBUS_TYPE_STRUCT,NULL,&struct_iter)
dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING,
&string1); <-----------Segmentation fault.
dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &string2);
dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_UINT32,
&value);
dbus_message_iter_close_container(&array_iter, &struct_iter);
dbus_message_iter_close_container(&args,&array_iter);
....
However I obtained a segmentation fault in the second line . what 's
wrong here?
Thanks.
--
------------------------------------------------------
Rafael Marin Lopez
Faculty of Computer Science-University of Murcia
30071 Murcia - Spain
Telf: +34968367645 e-mail: rafa at dif.um.es
------------------------------------------------------
More information about the dbus
mailing list