向txt文件中寫數據(每行三個數據)
try
{
CFile file(_T("E:\\1_3D.txt"), CFile::modeCreate | CFile::modeWrite);
char buf[128] = { 0 };
int j;
for (int i = 0; i<vect3DAlignFace.size(); i++)
{
//j = i;
sprintf(buf, "%.3f %.3f %.3f\r\n", vect3DAlignFace[i].x, vect3DAlignFace[i].y, vect3DAlignFace[i].z);
file.Write(buf, strlen(buf) * sizeof(char));
}
file.Close();
}
catch (CFileException* e)
{
e->ReportError();
e->Delete();
}
{
CFile file(_T("E:\\1_3D.txt"), CFile::modeCreate | CFile::modeWrite);
char buf[128] = { 0 };
int j;
for (int i = 0; i<vect3DAlignFace.size(); i++)
{
//j = i;
sprintf(buf, "%.3f %.3f %.3f\r\n", vect3DAlignFace[i].x, vect3DAlignFace[i].y, vect3DAlignFace[i].z);
file.Write(buf, strlen(buf) * sizeof(char));
}
file.Close();
}
catch (CFileException* e)
{
e->ReportError();
e->Delete();
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
CMake::CMakeLists.txt基本語法及常用
dieju8330
2020-07-08 10:35:13
while(cin)的理解
xudacheng06
2020-07-08 09:57:59
Operator new函數
xudacheng06
2020-07-08 09:57:59
C++中指針和引用的區別(轉)
沉沦风帆
2020-07-08 09:57:11
const和static const還有static區別
對於C/C++語言來講, const就是隻讀的意思,只在聲明中使用; static一般有2個作用,規定作用域和存儲方式.對於局部變量,static規
沉沦风帆
2020-07-08 09:57:11
使用std::function和std::bind實現函數回調
Ango_
2020-07-08 09:39:18
函數取地址與複製構造函數的使用
wenrenhua08
2020-07-08 09:06:32
C++ 中的explicit構造函數
C++ explicit構造函數 explicit按字面意思是明確的,顯式的。在C++類中只要定義的構造函數編譯器就不會幫你生成默認構造函數。
wenrenhua08
2020-07-08 09:06:32
C++ 中的const關鍵字
爲什麼使用const?採用符號常量寫出的代碼更容易維護;指針常常是邊讀邊移動,而不是邊寫邊移動;許多函數參數是隻讀不寫的。c
wenrenhua08
2020-07-08 09:06:21
鏈表的建立插入與刪除
陆家三少
2020-07-08 08:35:09
C++面試題之螺旋隊列
//螺旋隊列.cpp// 21 22 ... ...// 20 7 8 9 10// 19 6 1 2 11// 18 5 4 3 12// 17 16 15 14 13//看
陆家三少
2020-07-08 08:35:09
最大公約數的遞歸解法
陆家三少
2020-07-08 08:35:09