1:fprintf ()#include int fprintf (FILE *stream, const char *format, ...);The fprintf () function sends information (parameters) according to the specified format (format) to the file specified by the stream (stream). Therefore fprintf () enables the
reprinted from: http://blog.csdn.net/xidianzhimeng/article/details/235412891 fopenFunction prototype: File * fopen (const char * path,const char * mode); return value: When the file is opened successfully, the pointer to the stream will be returned.
Summary of Functions Fgets and fputs, Fread and Fwrite, fscanf, and fprintf usagestring read and Write functions fgets and fputsThe function of reading a string function Fgets function is to read a string into a character array from the specified
String read/write functions fgets and fputs
1. The fgets function of the string reading function reads a string from a specified file to a character array. The function is called in the form of fgets (character array name, n, file pointer );N is a
Fscanf, fprintf, fgets, fputs, fread, and fwrite functions, fscanffputs1. fscanf function and fprintf function 1.1 fscanf Function
The fscanf function can only be input in the format of a text file. The fscanf function is similar to the scanf
Fprintf formats the output to a file like printf, while fwrite writes data to a file in one byte block and one byte block.
Generally, fwrite is used to write data to binary files. However, fprintf, such as fprintf (FP, "%. 2f % C % d ", ftest,
String read/write functions fgets and fputs 1. The function of reading string functions fgets is to read a string from a specified file to a character array. The function is called in the form: fgets (character array name, N, file pointer); where N
1. fscanf function and fprintf function 1.1 fscanf functionThe FSCANF function can only be entered as a format from a text file. The FSCANF function is similar to the scanf function, except that the input object is the data for the text file on disk.
Format: int fgetc (File * stream );
Indicates reading a character from the object pointed to by the file pointer stream.
The return value of this function is a byte read.. If EOF is returned at the end of the file.
The prototype is char *
Since I have recently used the C language to read and write files, I would like to summarize the following to facilitate later searching.
In c, file operations are implemented by database functions, mainly divided into read and write operations. The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.