zoukankan      html  css  js  c++  java
  • fopen函数中的mode参数

    fopen

    FILE * fopen ( const char * filename, const char * mode );
    其中,参数mode可取以下值:

    "r"
    read: Open file for input operations. The file must exist.

    "w"
    write: Create an empty file for output operations. If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file.

    "a"
    append: Open file for output at the end of a file. Output operations always write data at the end of the file, expanding it. Repositioning operations (fseek, fsetpos, rewind) are ignored. The file is created if it does not exist.

    "r+"
    read/update: Open a file for update (both for input and output). The file must exist.

    "w+"
    write/update: Create an empty file and open it for update (both for input and output). If a file with the same name already exists its contents are discarded and the file is treated as a new empty file.

    "a+"
    append/update: Open a file for update (both for input and output) with all output operations writing data at the end of the file. Repositioning operations (fseek, fsetpos, rewind) affects the next input operations, but output operations move the position back to the end of file. The file is created if it does not exist.

    需要注意的是,对于 ”a” 或 “a+”,fseek, fsetpos, rewind 等重新定准的函数都是无效的,所有新写入的数据均追加至文件末尾。

     

    参考资料:

    http://www.cplusplus.com/reference/cstdio/fopen/

  • 相关阅读:
    系统角色权限问题
    解析JQuery Ajax
    JavaScriptSerializer序列化时间处理
    Javascript加载talbe(包含分页、数据下载功能)
    代理模式
    工厂模式
    单例模式
    Oracle内置函数
    Oracle大数据SQL语句优化
    Oracle大数据查询优化
  • 原文地址:https://www.cnblogs.com/outs/p/8983956.html
Copyright © 2011-2022 走看看