Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is that possible to use a string as a name in opencv FileStorage

I'd like to write an xml file using opencv FileStorage object.

Most of the examples I get to see works like the following

    FileStorage fs("d:\\1.xml" , FileStorage::WRITE); 
    fs << "one" << 1;

I'd like to write a section with modified name variable , which means that the text would not have to be inserted in compile time. I look for something like this:

    string st = "1"; 
    fs << st.c_str() << 1;

However I keep on getting run time error. it's refused to work, I have tried using opencv string type, stl string type , char* , but still can't make it work.

Any help would be very appreciated