Skip to content

Using FileStorage::APPEND #14130

@LaurentBerger

Description

@LaurentBerger

I cannot read data written in file when I use FileStorage:: APPEND

my code :

        FileStorage fs;
        fs.open("test.yml", FileStorage::WRITE);
        fs << "a" << 48;
        fs.release();
        fs.open("test.yml", FileStorage::APPEND);
        fs << "b" << 49;
        fs.release();
        fs.open("test.yml", FileStorage::READ);
        cout << int(fs["a"]) << endl;
        cout << int(fs["b"]) << endl;

result :
a = 48
b = 0

yml file is

%YAML:1.0
---
a: 48
...
---
b: 49

It works using xml file

PS I cannot find previous issue about append problem in yml but I can find many post on stackoverflow

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions