<?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: 13.5 &#8212; Stream states and input validation</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 16:52:45 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Martin</title>
		<link>http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/comment-page-1/#comment-68195</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Sat, 12 Sep 2009 18:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/#comment-68195</guid>
		<description>Thanks a lot. 
Really good article. Except I used 
cin.ignore(std::numeric_limits::max(),&#039;\n&#039;);
instead of 
cin.ignore(1000, &#039;\n&#039;); 

I had a problem with two loops because I used clear and ignore at wrong places. So if 123abc was entered, somehow my app just kept silent until I pressed enter. Using your sample code for
&quot;2) If you don’t want this to be valid input, it is not rejected (and you have garbage in your stream).&quot;

fixed my problems and now my integer validation works reliably no matter when and how often I use it.

Thanks.</description>
		<content:encoded><![CDATA[<p>Thanks a lot.<br />
Really good article. Except I used<br />
cin.ignore(std::numeric_limits::max(),&#8217;\n&#8217;);<br />
instead of<br />
cin.ignore(1000, &#8216;\n&#8217;); </p>
<p>I had a problem with two loops because I used clear and ignore at wrong places. So if 123abc was entered, somehow my app just kept silent until I pressed enter. Using your sample code for<br />
&#8220;2) If you don’t want this to be valid input, it is not rejected (and you have garbage in your stream).&#8221;</p>
<p>fixed my problems and now my integer validation works reliably no matter when and how often I use it.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Violator</title>
		<link>http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/comment-page-1/#comment-61837</link>
		<dc:creator>Violator</dc:creator>
		<pubDate>Tue, 02 Jun 2009 14:41:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/#comment-61837</guid>
		<description>And how do you filter out F1 to F12 keys?

[code]
while(i = _getch())				                           //validating input
{																
	if(i &gt; &#039;0&#039; &amp;&amp; i &lt; &#039;7&#039;)								
	break;
	cout &lt;&lt; &quot;Wrong number!&quot;; //input isn&#039;t valid
}
[/code]</description>
		<content:encoded><![CDATA[<p>And how do you filter out F1 to F12 keys?</p>
<p>[code]<br />
while(i = _getch())				                           //validating input<br />
{<br />
	if(i &gt; '0' &amp;&amp; i &lt; '7')<br />
	break;<br />
	cout &lt;&lt; "Wrong number!"; //input isn't valid<br />
}<br />
[/code]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sagar</title>
		<link>http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/comment-page-1/#comment-25955</link>
		<dc:creator>sagar</dc:creator>
		<pubDate>Tue, 02 Sep 2008 13:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/#comment-25955</guid>
		<description>good program&#039;s.
i want some programs which give from user only digits.something like this.
if u have please send me on my e-mail.</description>
		<content:encoded><![CDATA[<p>good program&#8217;s.<br />
i want some programs which give from user only digits.something like this.<br />
if u have please send me on my e-mail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 13.4 &#8212; Stream classes for strings</title>
		<link>http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/comment-page-1/#comment-14437</link>
		<dc:creator>Learn C++ - &#187; 13.4 &#8212; Stream classes for strings</dc:creator>
		<pubDate>Mon, 05 May 2008 02:33:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/135-stream-states-and-input-validation/#comment-14437</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 13.3 &#8212; Output with ostream and ios &#124; Home &#124; 13.5 &#8212; Stream states and input validation &#187;     Tuesday, March 18th, 2008 at 2:58 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 13.3 &#8212; Output with ostream and ios | Home | 13.5 &#8212; Stream states and input validation &raquo;     Tuesday, March 18th, 2008 at 2:58 [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
