473,651 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4601
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**********@n ews-pa1.hpl.hp.com> ,
Chris Dollin <ch**********@h p.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**********@n ews-pa1.hpl.hp.com> ,
Chris Dollin <ch**********@h p.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 "excruciati ngly 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**********@h p.comwrites:
Kenny McCormack wrote:
>In article <ge**********@n ews-pa1.hpl.hp.com> ,
Chris Dollin <ch**********@h p.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_Keit h) 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.x mission.com (Kenny McCormack) writes:
In article <ge**********@n ews-pa1.hpl.hp.com> ,
Chris Dollin <ch**********@h p.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_dem un...@yahoo.co. uk>
wrote:
gaze...@shell.x mission.com (Kenny McCormack) writes:
In article <ge4g57$9v...@n ews-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
5841
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 $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child
4
38720
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
2612
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 find the following lines of code: sysin = PyFile_FromFile(stdin, "<stdin>", "r", NULL);
0
1822
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 an EOF. After some debugging the reason for this appears to be that the stdin and stdout that the ReadLine function in the tokeniser include are not affected by my redirection and refer to a non-terminal so don't stall waiting for input from my...
23
7724
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 buffer ? are they same ? thanks ^^
6
2220
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 library input prompts will not happen if stdin is supplied by pipe or redirection. So, I would like to include a statement in the pluggin
5
8637
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 on cat(1). p = subprocess.Popen(, stdout = subprocess.PIPE, stdin = response)
2
4033
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 returns a successful exit value, and I can read the results it prints to STDOUT in PHP, but the perl script does not see STDIN from PHP. Since I want to use the perl script as a filter and I don't want to create an intermediary file, this is problematic....
0
1992
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 Python it's easy, use the ps1 prompt. --- begin --- import sys
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.