Function prototype Description |
Function |
return value |
void clearer (FILE *fp) |
Clears all error messages related to the file pointer fp |
No |
int fclose (FILE *fp) |
Closes the file referred to by the FP, releasing the file buffer |
Error returns non 0, otherwise returns 0 |
int feof (FILE *fp) |
Check if the file ends |
Returns 0 if the end of the file is not returned, otherwise 0 |
int fgetc (FILE *fp) |
Get the next character from the file referred to in the FP |
Error returns EOF, otherwise the read character is returned |
Char *fgets (char *buf,int N, FILE *FP) |
Reads a string of length n-1 from the file referred to by the FP and stores it in the BUF-referred storage area |
Returns the address referred to by BUF, or returns null if the file ends or an error occurs |
FILE *fopen (char *filename,char *mode) |
Open a file named filename in the mode specified by mode |
Successful, returns the file pointer (the start address of the file information area), otherwise returns null |
int fprintf (FILE *fp, Char *format, args,...) |
,... the Args Output to the FP-specified file in the format specified by format |
The actual number of characters to output |
int FPUTC (char ch, FILE *FP) |
Output ch characters to the FP-specified file |
The character is returned successfully, or EOF is returned |
int fputs (char *str, FILE *FP) |
Outputs the string str refers to the file referred to in the FP |
A non-negative integer was returned successfully, otherwise 1 (EOF) |
int fread (char *pt,unsigned size,unsigned N, FILE *FP) |
Reads the length from the FP-referred file size to n data items to a PT-referred file |
Number of data items read |
int fscanf (FILE *fp, char *format,args,...) |
The input data is deposited into the args,... in the format specified by format in the file referred to by the FP. Referred to in-memory |
Number of data entered, end of file or error returned 0 |
int fseek (FILE *fp,long offer,int Base) |
Position pointer of the file moved by the FP |
The current position is returned successfully, otherwise 0 is not returned |
Long Ftell (FILE *FP) |
Find the current read and write location of the file referred to by the FP |
Read and write location, error return -1l |
int fwrite (char *pt,unsigned size,unsigned N, FILE *FP) |
Enter the N*size bytes pointed to by PT into the file referred to in the FP |
Number of data items to output |
int getc (FILE *fp) |
Reads a character from a file that is referred to in the FP |
Returns the read character, if an error occurs or the end of the file returns EOF |
int GetChar (void) |
Reading the next character from a standard input device |
Returns the read character, if an error occurs or the end of the file returns-1 |
Char *gets (char *s) |
Reads a line of string from a standard device into the storage area referred to by S, replacing the read-in line break with '% ' |
Returns s, error returns null |
int printf (char *format,args,...) |
,... the Args Output to a standard output device in the format specified by format |
Number of output characters |
int PUTC (int ch, FILE *FP) |
With FPUTC |
With FPUTC |
int Putchar (char ch) |
Output ch to standard output device |
Returns the character of the output, or EOF if an error occurs |
Int puts (char *str) |
Output the STR string to the standard device and convert '% ' to carriage return newline. |
Returns the newline character, in case of an error, returns EOF |
int rename (char *oldname,char *newname) |
Change the file name referred to Oldname to the name of NewName |
Successfully returned 0, error returned-1 |
void Rewind (FILE *fp) |
Place the file position pointer at the beginning of the file |
No |
int scanf (char *format,args,...) |
The input data is deposited into the args from the standard input device in the format specified by format,... Referred to in-memory |
The number of data that has been entered |