c语言函数英文对照表,C语言文件操作函数大全(国外英文资料).doc

C语言文件操作函数大全(国外英文资料)

C语言文件操作函数大全

First, read and write standard documents

1. file open, fopen ()

The file open operation that will give the user specified file in the memory allocation of a FILE structure, and the structure of the pointer returned to the user program, after the user program is available in this FILE pointer to achieve access to the specified file operation. When using the open function, must give the file name, file operations (read, write or read and write), if the file name does not exist, it means to establish (only to write files to read the file, then the error), and the file pointer to the beginning of the file. If there is already a file with the same name, the file is deleted. If it does not have the same name file, the file is created and the file pointer is pointed at the beginning of the file.

Fopen (char, *filename, char, *type);

Where *filename is the file name pointer to open the file, usually expressed in double quotes, and also can be separated by double slashes. The *type parameter indicates how to open the file. The mode of operation available is as follows:

Mode meaning

"R" opens, read-only

"W" opens, the file pointer refers to the end, and only writes

"A" opens, points to the end of the file, and is appended to the existing file

"RB" opens a binary file that is read only

"WB" opens a binary file and writes only

"Ab" opens a binary file and appends it

"R+" opens an existing file in read / write mode

"W+" creates a new text file in read / write mode

"A+" opens a file file to append by reading / writing

"Rb+" opens a binary file in read / write mode

"Wb+" creates a new binary file in read / write mode

"Ab+" opens a binary file for additional purposes by reading / writing

When fopen (0 successfully opens a file, the function returns a FILE pointer and returns a NULL pointer if the file opens. If you want to open the test file, write it:

FILE *fp;

If ((fp=fopen ("test", "W")) ==NULL)

{

Printf ("File cannot be opened\n");

Exit ();

}

Else

Printf ("File open

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值