为什么每次只保存最后一次输出到文件中的呢,其他的不保存呢,是因为每次打开时,都将原来的清空了吗?
6条回答 默认 最新
shen_wei 2016-12-23 06:53关注"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.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报