我用这样的数据写了向量:
string filename= itemName+".yml";
FileStorage fs(filename, FileStorage::WRITE);
fs << "number_of_objects" << (int)vec.size();
fs << "objects" << "[";
for( int i=0; i < (int)vec.size(); ++i )
{
fs << "{";
fs << "x" << rc.x/imageScale;
fs << "y" << rc.y/imageScale;
fs << "w" << rc.width/imageScale;
fs << "h" << rc.height/imageScale;
fs << "}";
}
fs << "]";
但我无法读回来。
FileStorage fs(filename, FileStorage::READ);
if(!fs.isOpened())
return false;
int nObjects= 0;
fs["number_of_objects"] >> nObjects;
imageMarkupData.resize(nObjects);
for( int i=0; i < nObjects; ++i )
{
int x,y,w,h;
fs["x"] >> x;
fs["y"] >> y;
fs["w"] >> w;
fs["h"] >> h;
//...
}
什么是正确的方法?
答案 0 :(得分:0)
正确的方法是使用win32 {
VERSION_BUILD = $$system("set /a $$VERSION_BUILD + 1")
} else:unix {
VERSION_BUILD = $$system("echo $(($$VERSION_BUILD + 1))")
}
和FileNode
。
FileNodeIterator