0

I have data base:

point:
  A:
    w: 0.922068417
    x: -1.89226389
    y: -0.992412388
    z: -0.387026489
  B:
    w: 0.922068417
    x: -1.89226389
    y: -0.992412388
    z: -0.387026489
  a:
    x: -1.5980000000000001
    y: -0.40000000000000002
    z: 1
    w: 0.029999999999999999

When i want to remom point A in data, i haved tried many differennt way but it didn't work.

void delete_point(string name)
{
 // Open File YAML 
    YAML::Node config = YAML::LoadFile("../nodes/cpp_data.yaml");
    ofstream fout("../nodes/cpp_data.yaml");
    
    config.remove(config["point"][name]);
    // or use line code
    config["point"].remove(config["point"][name]);
    cout<< config["point"];
    // Save File YAML
    fout << config;
    fout.close();

    ROS_INFO("DONE DELETE POINT");
}

But when i save data ,it is successful What is this bug??

6
  • Please provide a minimal reproducible example Commented Nov 8, 2021 at 6:54
  • code is running successfull but data don't detete ,data is unchanged Commented Nov 8, 2021 at 7:16
  • I'm going to guess you are using yaml-cpp? It doesn't seem to have much in the way of documentation but going by the unit tests you need config["point"].remove(name) Commented Nov 8, 2021 at 8:06
  • stackoverflow.com/questions/42453826/… Commented Nov 8, 2021 at 8:08
  • Yeahhh, this is successful, thanks! Commented Nov 8, 2021 at 8:29

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.