while(file.pos()<file.size()) //-->
while(in.pos()<file.size())
while(file.pos()<file.size()) //-->
while(in.pos()<file.size())
To copy to clipboard, switch view to plain text mode
Somebody had helped me to solve the problem.
By the way, it's that any way to reuse output file name and QTextStream name? Such as:
if(month!=list.at(0))
{
QFile monthFile
(outDirName
+QDir::separator()+list.
at(0)+".txt");
month=list.at(0);
}
monthOut<<list.at(0)<<'\t'<<list.at(1)<<'\t'<<list.at(2)<<"\n";
if(month!=list.at(0))
{
QFile monthFile(outDirName+QDir::separator()+list.at(0)+".txt");
QTextStream monthOut(&monthFile);
month=list.at(0);
}
monthOut<<list.at(0)<<'\t'<<list.at(1)<<'\t'<<list.at(2)<<"\n";
To copy to clipboard, switch view to plain text mode
In my previous standard C++ code, I do it in this way:
while(getline(ifile, str))
{
filename = str.substr(0, 6)+".txt";
ofstream ofile(filename.c_str(), ios_base::app);
str.erase(0,10);
ofile << str << endl;
ofile.close();
}
while(getline(ifile, str))
{
filename = str.substr(0, 6)+".txt";
ofstream ofile(filename.c_str(), ios_base::app);
str.erase(0,10);
ofile << str << endl;
ofile.close();
}
To copy to clipboard, switch view to plain text mode
But I do think that reopen and reclose a file in this way is not a wise choice. But i can not work out a better method.
There are lots of problem to learn in practical experiment. Thanks sincerely to all the friends help me.
Bookmarks