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

转载于:https://www.cnblogs.com/xiongyunqi/p/3735350.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值