Closed y-Adrian closed 2 years ago
C has no native dictionaries like Python.
There is a document interface though.
https://github.com/yaml/libyaml/blob/master/tests/run-loader.c#L42
yaml_parser_load(&parser, &document)
To see what you can do with such a document struct, open the documentation of libyaml (see https://github.com/yaml/libyaml/releases - fetch the tarball and look under the doc directory).
Go to "Data Structures" - "yaml_document_s"
There you will find functions like yaml_document_add_sequence
, yaml_document_append_sequence_item
etc.
I don't know how much C you know, but in general a lot of things are more convenient in languages like Python than they are in C :)
You might also want to try https://github.com/pantoniou/libfyaml as it has a nice commandline tool with support to reference paths in the structure
Thank you! @perlpunk
When I want to use C programs to process yaml file, I found it is not so convenient compared to PyYaml. Like get specific value through the key.