C Programming - Library Functions - Discussion

Discussion Forum : Library Functions - General Questions (Q.No. 7)
7.
Can you use the fprintf() to display the output on the screen?
Yes
No
Answer: Option
Explanation:
Do like this fprintf(stdout, "%s %d %f", str, i, a);
Discussion:
15 comments Page 1 of 2.

Satish said:   1 decade ago
What is stdout, is it keyword ?

Riya said:   1 decade ago
stdout stands for standard output

ABDUL said:   1 decade ago
In which library this function exists ?

Diya said:   1 decade ago
Stdout is a special file pointer.

Sri said:   1 decade ago
What is the difference between printf() and fprintf()?

Cherry said:   1 decade ago
fprintf() prints data that only in particular file.

Krinta said:   1 decade ago
Stdout points to which default file ?

Prabhu said:   1 decade ago
printf("Hai friends\n"); //This will print output in stdout.

FILE *f=fopen("test.txt","w");
fprintf(f,"%s","HELLO"); // This will print the output in test.txt.

Indu said:   1 decade ago
Then what is the difference between printf and fprintf.

What will be the output if we give printf and what could be the output if it is fprintf?

I want to know the difference.

Priya said:   1 decade ago
Hi @Indu,

Output will be same, but the only difference is where it prints (i.e. location).

printf - prints the output on terminal.

fprintf - prints output in file, this file can be used for further calculations if necessary.


Post your comments here:

Your comments will be displayed after verification.