[問題] ofstream 開啟失敗
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VS2010
問題(Question):
目前有一段程式,會重複計算並把結果存到一個txt
程式執行初期都可正常存出txt
但在大量計算約幾百次後,就無法再開啟檔案
(fp.open()後也不會有空白的txt被開啟)
請問可能是甚麼原因? 感謝!
程式碼(Code):(請善用置底文網頁, 記得排版)
char filename[]="Result.txt";
ofstream fp;
fp.open(filename, ios::out);
if(!fp)
fp.open(filename, ios::out);
if(fp)
{
fp << xxxxxx;
fp << endl;
}
fp.close();
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.36.45.98
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1419131773.A.ECB.html
推
12/21 11:25, , 1F
12/21 11:25, 1F
→
12/21 11:25, , 2F
12/21 11:25, 2F
→
12/21 11:49, , 3F
12/21 11:49, 3F
→
12/21 11:50, , 4F
12/21 11:50, 4F
→
12/21 11:56, , 5F
12/21 11:56, 5F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):