Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quotation marks surrounding string during writing to file with OpenCV FileStorage
QtWS25 Last Chance

Quotation marks surrounding string during writing to file with OpenCV FileStorage

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    almatrah
    wrote on last edited by
    #1

    Hi Everybody
    My problem are quotation marks during writing to file. The code is

    cv::FileStorage fs(outputname.toStdString(), cv::FileStorage::WRITE);
    ...
    std::string str="test";
    fs << str.c_str();
    ...

    In file I got "test", but what I want is just test without quotations marks. Can anybody give me a hand?

    best regards

    1 Reply Last reply
    0
    • A Offline
      A Offline
      almatrah
      wrote on last edited by
      #2

      Hi
      Actually I found solution, but I'm not sure why it solved problem ?

          @outputname.push_back(dir+"/list.xml");
          cv::FileStorage fs(outputname.toStdString(), cv::FileStorage::WRITE);
          fs << "imagelist" << "[";
      
          // This doesn't work for me, put quotes
          // std::string str=imagesList.join(" ").toStdString().c_str();
          // I tried that but it doesn't help
          // str.erase(str.begin(),str.end()-(str.length()-1));
          // fs << str.c_str();
      
          // Finally iterator solved problem
          QStringList::const_iterator constIterator;
               for (constIterator = imagesList.constBegin(); constIterator != imagesList.constEnd(); ++constIterator)
                   fs << (*constIterator).toLocal8Bit().constData();
      
          fs << "]";
          fs.release();@
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved