473,320 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

initialization of stdin, stdout, stderr

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
Oct 27 '08 #1
8 4560
su**************@yahoo.com, India wrote:
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.hcan 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.honly 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

Oct 27 '08 #2
In article <ge**********@news-pa1.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>su**************@yahoo.com, India wrote:
>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
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!!!

Oct 27 '08 #3
Kenny McCormack wrote:
In article <ge**********@news-pa1.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>>su**************@yahoo.com, India wrote:
>>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
blah, blah, blah
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

Oct 27 '08 #4
Chris Dollin <ch**********@hp.comwrites:
Kenny McCormack wrote:
>In article <ge**********@news-pa1.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>>>su**************@yahoo.com, India wrote:

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
blah, blah, blah

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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 27 '08 #5
ga*****@shell.xmission.com (Kenny McCormack) writes:
In article <ge**********@news-pa1.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>>su**************@yahoo.com, India wrote:
>>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
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!!!
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
--
Christianity has such a contemptible opinion of human nature that it does
not believe a man can tell the truth unless frightened by a belief in God.
No lower opinion of the human race has ever been expressed.
-- Robert Green Ingersoll (1833-1899), American politician and scientist
Oct 28 '08 #6

"Phil Carmody" <th*****************@yahoo.co.ukwrote in message
>
Pffft! I had cardboard boxes as desks when I first moved here!
Cardboard boxes? Paving stones, that's what we had. Eee, that's what it was
like, it was.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Oct 28 '08 #7
Malcolm McLean wrote:
>
"Phil Carmody" <th*****************@yahoo.co.ukwrote in message
>>
Pffft! I had cardboard boxes as desks when I first moved here!
Cardboard boxes? Paving stones, that's what we had. Eee, that's what it
was like, it was.
At least you didn't have to eat gravel. Or live in t'middle o't'm62.
Oct 28 '08 #8
On 28 Oct, 00:23, Phil Carmody <thefatphil_demun...@yahoo.co.uk>
wrote:
gaze...@shell.xmission.com (Kenny McCormack) writes:
In article <ge4g57$9v...@news-pa1.hpl.hp.com>,
Chris Dollin *<chris.dol...@hp.comwrote:
>There isn't such a thing as "the" file `stdio.h`. Even if we ignore
blah, blah, blah
Some of this attribution is incorrect. It was Kenny McCormack who
snipped Chris Dollin's statement and wrote "blah, blah, blah"
(and incorrectly attributed that to Chris).
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.
I think you have the metaphor reversed. Those who claim that
stdio.h must be a file are the one's who would insist that
a cardboard box cannot be a desk. To say that stdio.h is
a file is like saying that a desk is a piece of mahogany
furniture with 3 drawers on each side, one in the middle,
and an ink well on the top. Anyone familiar with the
general notion of a desk will take exception to such
a claim. Similarly, the claim "stdio.h is a file"
in invalid.

Oct 29 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bernhard Kuemel | last post by:
Hi! I want to read/write commands and program input to/from /bin/bash several times before I close the stdin pipe. However, reading from cat hangs unless I first close the stdin pipe. <?php...
4
by: Jan Knop | last post by:
Hello I am writing a Windows application where I need to redirect stdin, stdout and stderr from Python. to my application Is it a simple way of do it ? Has anyone done it using Winsock ?
1
by: Vincent Touquet | last post by:
Hi, In a project where I have embedded Python in a C++ application, I have the need to replace what Python considers to be stdin, stdout and/or stderr. In sysmodule.c in the Python sources, I...
0
by: lickspittle | last post by:
Hi, I have Python embedded with my other code, and when my other code opens a console and redirects stdout, stdin and stderr to it, then calls PyRun_InteractiveLoop, it immediately returns with...
23
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard...
6
by: ccdrbrg | last post by:
What is the best way to protect stdin within a library? I am writing a terminal based program that provides plugin capability using the dlopen() API. Sequencing program commands (typed) and...
5
by: Cameron Laird | last post by:
Question: import subprocess, StringIO input = StringIO.StringIO("abcdefgh\nabc\n") # I don't know of a compact, evocative, and # cross-platform way to exhibit this behavior. # For now, depend...
2
by: kimonp | last post by:
I am running on windows XP with a fresh install of wamp5 (1.7.2) and mediawiki. I am trying to call a perl function from within php using proc_open. The perl script is being executed and...
0
by: Gabriel Genellina | last post by:
En Thu, 25 Sep 2008 09:49:31 -0300, Almar Klein <almar.klein@gmail.com> escribió: Use subprocess.PIPE Usually the tricky part is to figure out exactly whether there is more input or not. With...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.