Closed zhoufei1 closed 2 years ago
The input of these functions should be null-terminated strings,
you should use string.c_str()
instead of string.data()
.
Added to documentation: https://github.com/ibireme/yyjson/blob/master/doc/API.md#nul-character
Hi ibireme Thank you very much for your last reply, but I found a problem, please help me to solve it, and I look forward to your reply
////////////////////////////////// The output result of my case 2 method should be correct, but the output result of case 1 seems to be wrong. Can't you use function calls? There is still a problem with the method I use. Looking forward to your reply, thank you
output: "ROOT": { "key2": {}, "key23": {}, "LAYOUT_PATH_KEY_NODE": { "�\u0000\u0000\u0000\u0000\u0000\u0000\u0000�\u0000\u0000\u0000": [ "kkkkk33333", "wwwwwwwwww", "rrrrrrrrrr", "qqqqqqqqqqqqq" ] } }
Hi ibireme how do I want to dynamically insert data?
for example : std::vectorstd::string v{"kkkkk33333", "wwwwwwwwww", "rrrrrrrrrr", "qqqqqqqqqqqqq"}; yyjson_mut_val* arryNode; //obj or arry for(size_t i = 0; i < v.size(); ++i) yyjson_mut_arr_add_strcpy(doc, arryNode, v[i].data());
The file name suffix is .cpp, then compile with g++ ,Can I use g++ to compile?