Re: How it works?
- From: "Mike Wahler" <mkwahler@xxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 23:48:13 GMT
"Mohan" <mohan.smvec@xxxxxxxxx> wrote in message
news:1146353770.445575.238950@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Friends,
The following code is working fine and printing the string "Mohan S".
#include<stdio.h>
int main()
{
FILE *fp;
fp=stdout;
fprintf(fp,"%s","Mohan S");
}
My doubt is how it is possible to assign a standard output stream to a
file stream....
Because they have the same type. 'stdout' has
type 'FILE *'. 'stdout', 'stdin', and 'stderr'
*are* FILE* streams.
Why it didn't throw any error;
Why should it? What error do you expect?
instead its running
fine...
It should, except for one thing: The last character output
should be a '\n', or 'fflush()' should be called, or the
output isn't guaranteed to appear.
Can anyone give me clear explanations... ?
See above.
-Mike
.
- Follow-Ups:
- Re: How it works?
- From: Keith Thompson
- Re: How it works?
- References:
- How it works?
- From: Mohan
- How it works?
- Prev by Date: Re: Boost process and C
- Next by Date: Re: Combination problem - fast algorithm
- Previous by thread: How it works?
- Next by thread: Re: How it works?
- Index(es):
Relevant Pages
|