Skip to content
Discussion options

You must be logged in to vote

RTFM.

ryml::csubstr is a view, so it is NOT terminated by \0. You need to consider its length. So by using only .str you are constructing the multiple std::strings incorrectly, and that's why they go to the end of the file, because there is where the only \0 is located.

Do this instead:

ryml::csubstr n = item["Name"].val();
std::string name(n.str, n.len);

And likewise for the other strings.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by crupsa
Comment options

You must be logged in to vote
1 reply
@biojppm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants