initialization of stdin, stdout, stderr

S

subramanian100in

The file stdio.h just contains
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;

When are the standard streams stdin, stdout, stderr initialiazed ?
How are they initialiazed ?

Kindly explain.

Thanks
V.Subramanian
 
C

Chris Dollin

The file stdio.h just contains
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;

There isn't such a thing as "the" file `stdio.h`. Even if we ignore
that the standard headers don't need to be files /at all/, each
implementation's <stdio.h> can have different contents -- so long
as it provides what the standard requires and doesn't intrude into
the programmer's namespace.

Also, if your implementation's <stdio.h> only contains what you
mention above, it's not a conformant implementation, since it
doesn't declare `size_t`, `FILE`, `fpos_t`, `NULL`, `fopen`,
`fread`, `printf`, ... well, almost everything that's supposed
to be there.

What implementation is this?
When are the standard streams stdin, stdout, stderr initialiazed ?

Before `main` starts executing.
How are they initialiazed ?

However the implementation finds it convenient.

--
'Don't be afraid: /Electra City/
there will be minimal destruction.' - Panic Room

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England
 
K

Kenny McCormack

There isn't such a thing as "the" file `stdio.h`. Even if we ignore
blah, blah, blah

Get real. You mean that if I refer to a particular piece of furniture
in my office as "the desk", that I'm wrong? That somebody is going to
come along and explain in excruciatingly patronizing terms that there is
no such thing as "the desk" - because there are other desks in the world (*)
and, in fact (I know we shouldn't even mention this, but what the heck!),
there are offices in the world that don't even have a desk!!!

(*) And, as amazing as I might find this, and as hard as it is to
believe, they don't all look the same as my desk!!! Oh the shock!
Oh the horror!!!
 
C

Chris Dollin

Yeah, sure, Kenny, twit the "regulars" for being unhelpful, but
given half -- no, one-googleth -- a chance, pick on the only thing
you can wilfully misunderstand in a posting and misunderstand it
to death.
Get real.

Complex fits better.
You mean that if I refer to a particular piece of furniture
in my office as "the desk", that I'm wrong?

Sure, if you're pointing to a chair or teapot, or if you're
expecting agreement that the desk you're pointing to is /the/,
that is the only or the definitive, desk. Is that what you're
doing? (fx:tap-tap) I'm not getting video on this connection.

Of course the OP might not have realised that was the implication
of what they'd said, perhaps because of dialectic differences,
of which I don't question the existence. Perhaps you, too, were
unaware of this usage. Consider this a learning opportunity.
there are offices in the world that don't even have a desk!!!

Are you claiming that those are /conformant/ offices?
(*) And, as amazing as I might find this, and as hard as it is to
believe, they don't all look the same as my desk!!! Oh the shock!
Oh the horror!!!

Multiple exclamation marks!

--
Chris "excruciatingly patronizing" Dollin

'Don't be afraid: /Electra City/
there will be minimal destruction.' - Panic Room

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England
 
K

Keith Thompson

Chris Dollin said:
Yeah, sure, Kenny, twit the "regulars" for being unhelpful, but
given half -- no, one-googleth -- a chance, pick on the only thing
you can wilfully misunderstand in a posting and misunderstand it
to death.
[...]

Chris, please don't feed the troll. If you argue with Kenny, he wins;
don't play his game.
 
P

Phil Carmody

Get real. You mean that if I refer to a particular piece of furniture
in my office as "the desk", that I'm wrong? That somebody is going to
come along and explain in excruciatingly patronizing terms that there is
no such thing as "the desk" - because there are other desks in the world (*)
and, in fact (I know we shouldn't even mention this, but what the heck!),
there are offices in the world that don't even have a desk!!!

If your desk was in fact just a big cardboard box, would you still
call it a desk? Yes, it acts as a desk, but it's not really a desk.
So to the pedants, no, it's not a desk, but to the generalists,
it may as well be a desk, who cares what it really is.
(*) And, as amazing as I might find this, and as hard as it is to
believe, they don't all look the same as my desk!!! Oh the shock!
Oh the horror!!!

Pffft! I had cardboard boxes as desks when I first moved here!

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top