……………………………………………………………………………………………………
fopen
Return Values
|
Opens a file for buffered I/0.
FILE *fopen ( const char *filename, const char *access_mode );
filename
|
The name of the file to open.
|
access_mode
|
The type of access mode: r, w, a or r+, w+, a+, where the "+" sign indicates that the file must already exist.
|
The access_mode parameter serves also to specify whether we want to open the file as text or binary, adding t or b characters to this access mode string.
t
|
Text mode.
In text mode the end of file is assumed to be at first Ctrl+Z character. Some conversions can occur reading and writing with End Of Line / Feedback characters depending on your compiler and your Operating System.
|
b
|
Binary mode.
End of file is reached at last byte of the file. No conversions.
|
Note: Do not include operating system header files (e.g. stdio.h) in scripts. This will result, however, in some types, including the FILE type used here, to be undefined. Instead, substitute a long for the FILE type. See example.
/*int fwrite(void *buf, int size, int count, FILE *stream);
fwrite()
函数是把
buf
指针所指的缓冲器中
,
长度为
size
个字节的