<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: What&#8217;s the difference between printing to standard output and printing to standard error?</title>
	<atom:link href="http://www.colonial-printing.com/printing/whats-the-difference-between-printing-to-standard-output-and-printing-to-standard-error/feed" rel="self" type="application/rss+xml" />
	<link>http://www.colonial-printing.com/printing/whats-the-difference-between-printing-to-standard-output-and-printing-to-standard-error</link>
	<description>Custom Label Printing</description>
	<lastBuildDate>Fri, 03 Dec 2010 12:23:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: Ratchetr</title>
		<link>http://www.colonial-printing.com/printing/whats-the-difference-between-printing-to-standard-output-and-printing-to-standard-error/comment-page-1#comment-669</link>
		<dc:creator>Ratchetr</dc:creator>
		<pubDate>Wed, 03 Feb 2010 06:45:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.colonial-printing.com/printing/whats-the-difference-between-printing-to-standard-output-and-printing-to-standard-error#comment-669</guid>
		<description>When a C program starts up, the run time automatically opens 3 file handles for it:stdin, stdout and stderr. These really are just file handles, as in FILE *. Normally, stdin is connected to the keyboard, and stdout and stderr are connected to the display console. But if you redirect stdout to a file, then stdout goes to the file, while stderr will still go to the screen.

Since they really are just FILE * file handles, you can use them in any function that takes a FILE * parameter.
printf doesn&#039;t take a FILE *, but fprintf does. These 2 function calls are identical:
printf(&quot;Hello World\n&quot;);
fprintf(stdout,&quot;Hello World\n&quot;);

For most functions that read the keyboard or write to the screen, there is another function of the same name, but starting with f... puts() --&gt; fputs().  gets() --&gt; fgets(), etc.

If you were to do this:
fprintf(stderr,&quot;Saying Hello World\n&quot;);
printf(&quot;Hello World\n&quot;);
and run it as:
sayhello &gt; hello.txt

Then you should see &#039;Saying Hello...&#039; on the screen, and have &#039;Hello World&#039; in hello.txt file.

Sorry if that was too much detail ;-)&lt;br&gt;&lt;b&gt;References : &lt;/b&gt;&lt;br&gt;</description>
		<content:encoded><![CDATA[<p>When a C program starts up, the run time automatically opens 3 file handles for it:stdin, stdout and stderr. These really are just file handles, as in FILE *. Normally, stdin is connected to the keyboard, and stdout and stderr are connected to the display console. But if you redirect stdout to a file, then stdout goes to the file, while stderr will still go to the screen.</p>
<p>Since they really are just FILE * file handles, you can use them in any function that takes a FILE * parameter.<br />
printf doesn&#8217;t take a FILE *, but fprintf does. These 2 function calls are identical:<br />
printf(&quot;Hello World\n&quot;);<br />
fprintf(stdout,&quot;Hello World\n&quot;);</p>
<p>For most functions that read the keyboard or write to the screen, there is another function of the same name, but starting with f&#8230; puts() &#8211;&gt; fputs().  gets() &#8211;&gt; fgets(), etc.</p>
<p>If you were to do this:<br />
fprintf(stderr,&quot;Saying Hello World\n&quot;);<br />
printf(&quot;Hello World\n&quot;);<br />
and run it as:<br />
sayhello &gt; hello.txt</p>
<p>Then you should see &#8216;Saying Hello&#8230;&#8217; on the screen, and have &#8216;Hello World&#8217; in hello.txt file.</p>
<p>Sorry if that was too much detail <img src='http://www.colonial-printing.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> <br /><b>References : </b></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: www.colonial-printing.com @ 2012-02-09 06:44:20 -->
