程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> 文件操作-c++輸出到文件中保存不全

文件操作-c++輸出到文件中保存不全

編輯:編程解疑
c++輸出到文件中保存不全

為什麼每次只保存最後一次輸出到文件中的呢,其他的不保存呢,是因為每次打開時,都將原來的清空了嗎?

最佳回答:


 "r" 
Opens for reading. If the file does not exist or cannot be found, the fopen call fails. 
"w" 
Opens an empty file for writing. If the file exists, its contents are destroyed. 
"a" 
Opens for writing at the end of the file (appending) without removing the EOF marker before writing new data to the file; creates the file first if it doesn't exist. 
"r+" 
Opens for both reading and writing. (The file must exist.) 
"w+" 
Opens an empty file for both reading and writing. If the file exists, its contents are destroyed. 
"a+" 
Opens for reading and appending; the appending operation includes the removal of the EOF marker before data is written to the file and the EOF marker is restored after writing is complete; creates the file first if it doesn't exist. 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved