473,396 Members | 1,815 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,396 software developers and data experts.

what are the STDOUT, STDERR,STDUPDATE streams?

what are the STDUPDATE, STDERR, STDOUT and STDIN streams and how does
one access these streams in C language. I am aware of the function
fprintf(FILE *fp, char * format, char *s) which puts the string into
the corresponding streams. But can you please tellme where does the
content go exactly when we put it into the above streams. In which
cases can we see the outpt and in which cases cant we see and why so?
It would be great if you can give me an example.
Bye

Feb 21 '06 #1
2 2799
Abhishek wrote:

what are the STDUPDATE,
I don't know.
STDERR, STDOUT and STDIN streams
Standard error stream, standard output stream,
and standard input stream.
and how does
one access these streams in C language.
They are opened automatically when a hosted C program executes.
The stdout, stdin, and stderr macros, are (FILE *) values.
They are used similarly to the way
that the return value of fopen() is used,
except they get closed automatically at the end of the program
so fclose(), doesn't apply to them.
I am aware of the function fprintf(FILE *fp, char * format, char *s)
#include <stdio.h>
int fprintf(FILE * restrict stream,
const char * restrict format, ...);
which puts the string into
the corresponding streams. But can you please tellme where does the
content go exactly when we put it into the above streams.
Each stream is associated with a file or device.
On my machine, the standard input stream
is associated with my keyboard.
The standard output and standard error streams are associated
with my monitor.
In which
cases can we see the outpt and in which cases cant we see and why so?
It would be great if you can give me an example.


/* BEGIN new.c */

#include <stdio.h>

int main(void)
{
fputs("\nIf you can read this,\n"
"then you're looking at the device "
"which is associated with\n"
"the standard output stream\n", stdout);

fputs("\nIf you can read this,\n"
"then you're looking at the device "
"which is associated with\n"
"the standard error stream\n", stderr);

puts("\n\nEnter a string for the standard input stream.");
fscanf(stdin, "%*[^\n]");
if (!feof(stdin)) {
getc(stdin);
}

puts("\nOK, that's all there is.");

return 0;
}

/* END new.c */

--
pete
Feb 21 '06 #2
Abhishek wrote:

what are the STDUPDATE, STDERR, STDOUT and STDIN streams and how does
one access these streams in C language. I am aware of the function
fprintf(FILE *fp, char * format, char *s) which puts the string into
the corresponding streams. But can you please tellme where does the
content go exactly when we put it into the above streams. In which
cases can we see the outpt and in which cases cant we see and why so?
It would be great if you can give me an example.


They don't exist. What does exist are stdout and stderr for
output, and stdin for input. To see where the streams are
delivered, see your systems documentation. The most common thing
is the associated terminal.

You access them by reading or writing to them. For example:

intvalue = getc(stdin);
or
intvalue = getchar(); /* assumes stdin */

Please do not fail to read the following URLs and advice before
posting again.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Feb 21 '06 #3

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

Similar topics

2
by: Hans Deragon | last post by:
Greetings. I am performing: commands.getstatusoutput("rsync <params>"); rsync takes a long time and prints out a steady stream of lines showing which file it is currently working on.
4
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
140
by: Oliver Brausch | last post by:
Hello, have you ever heard about this MS-visual c compiler bug? look at the small prog: static int x=0; int bit32() { return ++x; }
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...
37
by: nobody | last post by:
I am writing a framework that other developers will write plug-ins for. I would like for one of the features of the framework to be to intercept all text written to stdout/stderr and prepend...
2
by: Murali | last post by:
Hi Python programmers, I need to be able to read the stdout and stderr streams of an external program that I launch from my python script. os.system( 'my_prog' + '>& err.log' ) and was planning...
2
momotaro
by: momotaro | last post by:
Hello! am wondring if stdin, stdout and stderr are of any help since we can do the same thing using 'printf' for example: fprintf(stdout, "%s", message); is exactely the same as: ...
7
by: Cell | last post by:
when both are connected to screen and the anything written to these two constant file pointers will go onto the screen ?
8
by: subramanian100in | last post by:
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 ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.