Fprintf in C Programming Language

Fprintf in C

fprintf() function in C


    int fprintf(FILE *filename, const char *string, . . . .);


    FILE *filename, const char *string etc.

Return type: int

Use of function:

Like printf() function, fprintf() function is used to write the argument statement string on the file stream. Through the fprintf() function we write or store the values with the string. The prototype of the function fprintf() is: int fprintf(FILE *filename, const char *string, . . . .);

Here string is the user defined string along with the existing data types (likes int, float, char etc).

fprintf() example in C


#include <stdio.h> #include <stdlib.h> int main() {