1

Help! I know use the following codes can write datas to a particular .yml file.

FileStorage fs("test.yml", FileStorage::WRITE);   
    fs << "frameCount" << 5;

Now the test.yml is an already exist .yml file and have multiple keys and variables, but I only want to change one of the variables. However, if I use the above codes, the .yml will be cleaned up and only remain the key "frameCount", which is not expected.

So, is there anyway to change one part of .yaml why remain other parts? Just like we modify a file without clean up it.

Please help

LinTIna
  • 481
  • 1
  • 6
  • 14
  • I suppose this can be done without opencv? Since it is a text file, I think focusing on editing the string will be easier. – hkchengrex Aug 24 '18 at 02:05
  • sorry I don't understand, I want to change the .yaml file during my codes running. I can only read the .yaml file string and then edit it, but how can I straightly edit the string in the .yaml file? (which means the change will remain in the .yaml file) – LinTIna Aug 24 '18 at 02:09
  • Oh sorry now I understand your question. I don't really have a good answer besides loading all the values in the yaml and then write again with some of them edited. Besides, it is asked [here](https://stackoverflow.com/questions/11387497/how-to-edit-update-yaml-file-in-opencv) – hkchengrex Aug 24 '18 at 02:29
  • Possible duplicate of [How to edit / update YAML file in OpenCV?](https://stackoverflow.com/questions/11387497/how-to-edit-update-yaml-file-in-opencv) – hkchengrex Aug 24 '18 at 02:30
  • Thank you for your kind help! – LinTIna Aug 24 '18 at 08:51

0 Answers0