Am 08.12.2011 20:00, schrieb Abderrahim Kitouni:
> Hello,
> في ث، 06-12-2011 عند 16:26 +0100 ، كتب Guenther Niess:
>> Hi,
>> I'm quite new and have a problem to initialize a struct. In the
>> tutorial and faq there are ways, but I think I have to manage the
>> memory manually in order to use libxml.
>
> Here is an example of allocating the struct manually:
>
> public struct MyStruct {
> int i;
> int j;
> }
>
> public void main () {
> MyStruct* str = malloc (sizeof (MyStruct));
> *str = MyStruct () {i = 1, j = 2};
>
> print ("%d %d\n", str->i, str->j);
> delete str;
> }
Thanks a lot! That's what I was looking for, it works!
Guenther
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list