ifstream inFile1;
inFile1.open("a.txt", ios_base::in);
if (!inFile1.is_open())
{
cout<<"打开导入文件文件失败,请检查是否存在导入文件"<<endl;
return false;
}
char szBuffer1[120] = "0";
string str1;
while (getline(inFile1,str1))
{
cout<<str1<<endl;
}
//cout<<inFile1.rdbuf()<<endl;
inFile1.close();
写文件例子:
string sql = "test";
ofstream outFile;
outFile.open(strExportFileName.c_str(), ios_base::app);
if (!outFile.good())
{
cout<<"打开文件失败"<<endl;
return false;
}
outFile<<sql;
outFile.close();
1万+

被折叠的 条评论
为什么被折叠?



