Fprintf in C Programming Language

Fprintf in C


fprintf() function in C

Prototype:

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

Parameters:

    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() {