C 文件读写参数设置代表的意义

MSDN:

"r"

Opens for reading. If the file does not exist or cannot be found, the fopen call fails.

以读的方式打开文件,如果文件不存在fopen打开文件失败。

"w"

Opens an empty file for writing. If the given 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 given file exists, its contents are destroyed.

覆盖方式打开文件。

"a+"

Opens for reading and appending; the appending operation includes the removal of the EOF marker before new 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值