fopen中r+和w+的区别是什么?

如题所述

    r+: Open for reading and writing.  The stream is positioned  at  the beginning of the file.

    w+:Open for reading and writing.  The file is created  if  it  does not  exist, otherwise it is truncated.  The stream is positioned at the beginning of the file.

    r+具有读写属性,从文件头开始写,保留原文件中没有被覆盖的内容;

    w+具有读写属性,写的时候如果文件存在,会被清空,从头开始写。

温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜