保存:
保存的时候可以用空格或者逗号都可以,看你需要了,如果这个文件你还要读,那么最好用空格;
std::ifstream fin("C://Users//Mloong//Desktop//read.csv"); //open file
std::ofstream out_8("C://Users//Mloong//Desktop//write.csv"); //save file
std::string line;
getline(fin, line);
do {
std::istringstream iss;
iss.str(line);
double x, y, z;
iss >> x >> y >> z; //我这里一行有三个数,以空格保存
// test
double px = x;
double py = y;
double pz = z;
out_8 << px << "," << py << "," << pz << "\n"; //以逗号保存(也可以以空格保存)
}while (getline(fin, line));
out_8.close();