help-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using librec


From: Bithov Vinu Student
Subject: Re: Using librec
Date: Thu, 6 May 2021 16:55:17 +0100

Cool, thanks!

So after doing the commands in your first email, I'd have to create an mset,  adapt the code in your second email, and then write to disk?


On Thu, 6 May 2021, 13:25 Jose E. Marchesi, <jemarch@gnu.org> wrote:

> 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.

Student Account
Calday Grange Grammar School is a charitable company limited by guarantee and registered in England and Wales with company number 8332696.
The Registered Office is at Grammar School Lane, West Kirby, Wirral, CH48 8GG

reply via email to

[Prev in Thread] Current Thread [Next in Thread]