1. 程式人生 > >c++ 動態建立的二維陣列儲存到csv檔案中

c++ 動態建立的二維陣列儲存到csv檔案中

void PreProcessFunction::saveTwoDimentionArr2csv(signed short **arr, int row, int col, char*filename)
{
	ofstream outFile;
	outFile.open(filename, ios::out); // 開啟模式可省略
	for (int j = 0; j < row; j++)
	{
		for (int i = 0; i < col; i++)
		{
			outFile << arr[j][i] << ',';
		}
		outFile << '\n';
	}
	outFile.close();

}