|
From: | Bithov Vinu Student |
Subject: | Re: Using librec |
Date: | Thu, 6 May 2021 16:55:17 +0100 |
> Thanks for your quick response! If you don't mind, could you give me an
> example usage of creating a multi-set/record? Some functions need typedef
> function pointers, which I can't make heads or tails of.
This is how you would create a rec_record_t with the following record:
Foo: bar
# this is a comment
Bar: baz
The code:
rec_field_t f1 = rec_field_new ("Foo", "bar");
rec_comment_t c = rec_comment_new ("this is a comment");
rec_field_t f2 = rec_field_new ("Bar", "baz");
rec_record_t rec = rec_record_new ();
rec_mset_t rec_elements = rec_record_mset (rec):
rec_mset_append (rec_elements, MSET_FIELD, f1, MSET_ANY);
rec_mset_append (rec_elements, MSET_COMMENT, c, MSET_ANY);
rec_mset_append (rec_elements, MSET_FIELD, f2, MSET_ANY);
Working with record sets is similar: they also have a mset that contains
MSET_RECORD or MSET_COMMENT elements.
[Prev in Thread] | Current Thread | [Next in Thread] |