Closed xunleiwu closed 3 years ago
You can certainly use any string as input to the scanf methods.
for instance:
char fmt[256];
snprintf(fmt, sizeof(fmt), "%s %%d", "key");
printf("fmt is \"%s\"\n", fmt);
atoi(fy_node_get_scalar() ? : "0")
In https://github.com/pantoniou/libfyaml#usage-and-examples, there is
count = fy_document_scanf(fyd, "/invoice %u " "/bill-to/given %256s", &invoice_nr, given);
User has to hardcode the key in the _scanf() call. Is there a way to do something like thiscount = fy_document_scanf(fyd, "%s %u " "%s %256s", key1, &invoice_nr, key2, given);
In the doc page of fy_node_scanf(), https://pantoniou.github.io/libfyaml/libfyaml.html#fy-node-scanf
fyn = { foo: 3 } -> fy_node_scanf(fyn, "/foo d", struct var) -> var = 3
Again, user has to hardcode the key, e.g. "/foo", in the _scanf() call. Since fyn has been located already, is there a way to do something like this?fyn = { foo: 3 } -> fy_node_scanf(fyn, "d", struct var) -> var = 3
There is also fy_node_get_scalar() API which returns a char*. Are there API's to get numeric values?
Thank you very much for the insight.