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

fopen fclose feof fgets fetl的更多相关文章

  1. PHP 文件处理----fopen(),fclose(),feof(),fgets(),fgetc()

    fopen() 函数用于在 PHP 中打开文件. 打开文件 fopen() 函数用于在 PHP 中打开文件. 此函数的第一个参数含有要打开的文件的名称,第二个参数规定了使用哪种模式来打开文件: < ...

  2. 文件流:"fopen","fclose",“ftell”"fseek","fgets","fprintf" ,“feof”,"fwrite","fread"

    char const* filename="D:/hello.txt"; 路径名使用的是“/”或者使用 转义字符“\\”: "fopen", FILE *fp= ...

  3. c++ 网络编程(七) LINUX下 socket编程 基于套接字的标准I/O函数使用 与 fopen,feof,fgets,fputs函数用法

    原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/9614820.html 一.标准I/O 1,什么是标准I/O?其实是指C语言里的文件操作函数,如 ...

  4. 文件操作 fopen() fclose()

    #define _CRT_SECURE_NO_DEPRECATE /*取消scanf,printf不安全之类的错误提示*/ /* fopen example */ #include <stdio ...

  5. fopen/fclose

    在操作文件之前要用fopen打开文件,操作完毕要用fclose关闭文件; 打开文件就是在操作系统中分配一些资源用于保存该文件的状态信息,并得到该文件的标示,以后用户程序就可以这个标志对文件做各种操作了 ...

  6. 标准IO: 文件的打开与关闭函数 fopen & fclose

    (1) 流(stream)和文件(file)    流和文件 在Turbo C2.0中是有区别的, Turbo C2.0 为编程者和被访问的设备之间提供了一层抽象的东西, 称之为"流&quo ...

  7. PHP读取文件的多种方法

    1.传统的方法 fopen, fclose feof:file.end of file 例子: $file_handle = fopen("c:\\myfile.txt", &qu ...

  8. C博客作业06—结构体&指针

    1.本章学习总结 1.1思维导图 1.2本章学习体会 明白了结构体的定义及使用方法 学会了fopen,fclose,feof等文件操作函数,学会使用c语言进行文件操作 大作业中的部分函数出现未知错误且 ...

  9. open和fopen的区别

    open和fopen的区别: 1.缓冲文件系统缓冲文件系统的特点是:在内存开辟一个“缓冲区”,为程序中的每一个文件使用,当执行读文件的操作时,从磁盘文件将数据先读入内存“缓冲区”, 装满后再从内存“缓 ...

随机推荐

  1. zookeeper leader选举算法源码

    服务器状态 在QuorumPeer中有定义,这个类是一个线程. LOOKING:寻找Leader状态.处于该状态时,它会认为当前集群中没有Leader,进入选举流程. FOLLOWING: LEADI ...

  2. jsp+servlet登录框架模板

    一.建立一个名叫jsp_servlet的工程 二.建立一个AcountBean类和CheckAccount类 1.AcountBean类包含登录名(username)和登录密码(password) p ...

  3. java_web学习(九) PreparedStatement动态参数的引入

    一.PreparedStatement 概述 在数据库的操作过程中,PreparedStatement 对象是一个很不起眼但是记为重要的接口对象,它继承 于Statement,并与之在两方面有所不同: ...

  4. 从“思考”的角度来看如何成为一名优质的Java架构师

    导读: 架构师应不应该写代码 为什么别人的系统总是那么烂 成为架构师最困难的门槛是什么? 如何更高效的学习? 1.架构师应不应该写代码 合格的程序员对于明确分配的任务会完成的很好,但是大部分情况下&q ...

  5. haslib 模块

    一.模块简介 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定的数据串( ...

  6. EC+VO+SCOPE for ES3

    词法环境 词法作用域 词法作用域(lexcical scope).即JavaScript变量的作用域是在定义时决定而不是执行时决定,也就是说词法作用域取决于源码. 词法环境 用于定义特定变量和函数标识 ...

  7. ECharts插件的使用

    ECharts插件:官网下载echarts.js开发者可以选择源码.下载地址:http://echarts.baidu.com/download.html 下载之后,echarts.js放在js文件夹 ...

  8. java中的分支结构 switch case的使用

    switch(A),括号中A的取值只能是整型或者可以转换为整型的数值类型,比如byte.short.int.char.string(jdk1.7后加入)还有枚举:需要强调的是:long是不能用在swi ...

  9. Java | 原来 try 还可以这样用啊?!

    本文首发于 http://youngzy.com/ 习惯了这样的try: try { } catch (Exception e) { } 看到了这样的try,觉得有点神奇: try(...) { } ...

  10. 刚装上最新node,npm install报这个错误!求ndoe大神解答!!!

    npm -v和node-v都可以打印出来但是 npm install就报错! 解决方法:网络问题,建议使用cnpm install命令安装npm,再运行npm run dev 命令