zoukankan      html  css  js  c++  java
  • fopen fclose feof fgets fetl

    fopen :Open file, or obtain information about open files

    例如

    fid = fopen(filename, permission)%许可包括:

    'r'     Open file for reading (default).

    'w'  Open file, or create new file, for writing; discard existing contents, if any.

    'a'   Open file, or create new file, for writing; append data to the end of the file.

    'r+'  Open file for reading and writing.

    'w+' Open file, or create new file, for reading and writing; discard existing contents, if any.

    'a+'  Open file, or create new file, for reading and writing; append data to the end of the file.

    'A'   Append without automatic flushing; used with tape drives.

    'W'  Write without automatic flushing; used with tape drives.

    fclose Close one or more open files

     ST = FCLOSE('all') closes all open files, except 0, 1 and 2.如果输入参数'all',则关闭除0,1,2之外的文件。

    feof Test for end-of-file

    ST = feof(fid) returns 1 if the end-of-file indicator for the file with file identifier FID has been set, and 0 otherwise.检测文件指标是否在文件末尾。
    ferror Query the MATLAB? software about errors in file input or output
    fgetl 
    Read line from file, discarding newline character每次读一行,去掉换行符。

    注意:读的是文件句柄!!
    fgets
     
    Read line from file, keeping newline character每次读一行,保留换行符。

    fprintf Write formatted data to file
    fread Read binary data from file
    frewind Move file position indicator to beginning of open file
    fscanf Read formatted data from file

  • 相关阅读:
    在OpenEuler中安装轻量化调试工具CGDB
    nginx服务器 server location映射路径配置
    hadoop HDFS文件系统角色及文件读写流程
    Linux系统Tomcat服务自启动脚本
    Linux系统软件安装的三种方式
    linux基础命令
    Java多线程解析
    多线程的典型应用场景---多个生产者多个消费者对共享资源的处理
    10.16变量的作用域和生存周期
    10.15sizeof用法
  • 原文地址:https://www.cnblogs.com/xiongyunqi/p/3735350.html
Copyright © 2011-2022 走看看