void divide(const std::string& filename, int lineSize)
{
std::ifstream fin(filename.c_str());
int fileCount = 1;
int lineCount = 1;
std::stringstream stream;
stream << "a_" << fileCount << ".txt";
std::ofstream* fout = new std::ofstream(stream.str().c_str());
while(!fin.eof()){
char line[256];
fin.getline(line, sizeof(line));
(*fout) << line << std::endl;
++lineCount;
if (lineCount > lineSize) {
fout->close();
delete fout;
++fileCount;
lineCount = 1;
stream.str("");
stream << "a_" << fileCount << ".txt";
fout = new std::ofstream(stream.str().c_str());
}
}
fout->close();
delete fout;
}
で、
std::stringstream stream;
の場所でクラステンプレートを使用するにはテンプレート引数リストが必要ですと
エラーが出るんですが、対応方法がよくわかりません。
よろしくお願いします。
環境:WindowsXP、VisualC++2008ExpressEdition