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. 五分钟学习React(三):纯HTML代码搭建React应用

    上一期我们使用了React官方的脚手架运行React应用.大家可能会觉得这种方法很繁琐,需要配置各种第三方插件.JQuery时代的前端真是让人怀念.这一期,我就带领大家创建一个"怀旧版&qu ...

  2. jq龙禧轮播图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. IdentityServer Topics(4)- 登录

    为了使IdentityServer代表用户发布令牌,该用户必须登录到IdentityServer. Cookie认证 使用来自ASP.NET Core的cookie身份验证处理程序管理的cookie跟 ...

  4. React Native学习(三)—— 使用导航器Navigation跳转页面

    本文基于React Native 0.52 参考文档https://reactnavigation.org/docs/navigators/navigation-prop 一.基础 1.三种类型 Ta ...

  5. deeplearning.ai 构建机器学习项目 Week 2 机器学习策略 II 听课笔记

    1. 误差分析(Error analysis) 误差分析的目的是找到不同误差源的比重,从而指引我们接下来往哪个方向努力改进.NG建议手工统计随机100个错误的误差源,比如对于猫分类器,错误的照片可能是 ...

  6. reduce 方法 (Array) (JavaScript)

    对数组中的所有元素调用指定的回调函数.该回调函数的返回值为累积结果,并且此返回值在下一次调用该回调函数时作为参数提供. 语法         array1.reduce(callbackfn[, in ...

  7. UESTC30-最短路-Floyd最短路、spfa+链式前向星建图

    最短路 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) 在每年的校赛里,所有进入决赛的同 ...

  8. Hat's Fibonacci(大数加法+直接暴力)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1250 hdu1250: Hat's Fibonacci Time Limit: 2000/1000 M ...

  9. linux命令 uname -r 和 uname -a 的解释与演示

    1.uname -r : 显示操作系统的发行版号2.uname -a :显示系统名.节点名称.操作系统的发行版号.内核版本等等. 系统名:Linux 节点名称: iZ2zeeailqvwws5dcui ...

  10. 教你如何解决Sublime Text 3使用中出现的中文乱码问题

    Sublime Text 3 是一个非常不错的源代码及文本编辑器,但是不支持GB2312和GBK编码在很多情况下会非常麻烦. 不过Sublime Package Control所提供的插件可以让Sub ...