Save a YAML Emitter content to a file with YAML-CPP -


i started playing around yaml-cpp, managed build , run of examples yaml-cpp wiki can't find way save emitter file.

is not possible? mean pyyaml library has 'dump' function this. there no such functionality in yaml-cpp? there workaround converting yaml emitter stl stream , dumping yaml file?

please let me know

thanks, adam

the function emitter::c_str() returns null-terminated c-style string (which not have release), can write file. example:

yaml::emitter emitter; emitter << "hello world!";  std::ofstream fout("file.yaml"); fout << emitter.c_str(); 

there emitter::size(), returns number of bytes in string, in case want more advanced , don't want walk string find length.

if want dump node stream, there's shortcut:

yaml::node node = ...; std::ofstream fout("file.yaml"); fout << node; 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -