Question:
Can you use the function fprintf()to display the output on the screen?
Answer:
Source: CoolInterview.com
Use it as:
fprintf( stout, "Hello %s ", name ); this line prints Hello on the console.
to print "Hello" in a file, put the file pointer in the place of stdout eg: fprintf( fp, "Hello %s ", name );
however, the file should be opened in write mode since we are writing. Source: CoolInterview.com
Answered by: Manik Sidana | Date: 8/11/2008
| Contact Manik Sidana
no u can't do it...it is used to write data into the file... Source: CoolInterview.com
Answered by: priya ranjan pani | Date: 8/11/2008
| Contact priya ranjan pani
Yes. by duplicating the ostream file descriptor Source: CoolInterview.com
Answered by: Kiran | Date: 6/11/2009
| Contact Kiran
#include<stdio.h> int main() { char name[10]="prachee"; fprintf( stdout, "Hello %s ", name );
getchar(); return 0; } Source: CoolInterview.com
Answered by: prachee | Date: 12/20/2009
| Contact prachee
fprintf(fp,"%d",printf("Hello"));
THis prints Hello on screen Source: CoolInterview.com
Answered by: Swamy | Date: 2/5/2010
| Contact Swamy
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|