#include
#include
#include
#include
using namespace std;
int main() {
//写文件
ofstream outFile; //ofstream outFile("file.csv", ios::app);
outFile.open("file.csv", ios::app); //“file.csv” 文件名; ios::app 末尾追加模式 out/in/...
outFile << "name" <<"," << "age"<> strAry;
while(getline(inFile, lineStr))
{
//打印整行字符串
cout << lineStr << endl;
//存成二维表结构
stringstream ss(lineStr);
string str;
vector lineAry;
//按照逗号分隔
while(getline(ss, str, ','))
lineAry.push_back(str);
strAry.push_back(lineAry);
}
getchar();
return 0;
}