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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -