c++将数据写入TXT文件

		char buf[22];
       ofstream fin("bspline.txt");
    for (int i = 0; i < Bspline.size(); i++) {
	     sprintf_s(buf,"%lf", Bspline[i].Getx());
		fin.write(buf,strlen(buf));
		fin.write("\0", 1);
		sprintf_s(buf, "%lf", Bspline[i].Gety());
		fin.write(buf, strlen(buf));
		fin.write("\0", 1);
		fin.write("\r\n", 2);
	}
	fin.close();

c++将数据写入TXT文件_第1张图片

你可能感兴趣的:(c++将数据写入TXT文件)