<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
					xmlns:content="http://purl.org/rss/1.0/modules/content/"
					xmlns:wfw="http://wellformedweb.org/CommentAPI/"
					xmlns:atom="http://www.w3.org/2005/Atom"
				  >
<channel>
<atom:link rel="self"  type="application/rss+xml"  href="http://rulinux.net/rss_from_sect_4_subsect_6_thread_5219"  />
<title>rulinux.net - Форум - Development - [Глупый вопрос] Проскакивает getchar()</title>
<link>http://rulinux.net/</link>
<description><![CDATA[Портал о GNU/Linux и не только]]></description>
<image><title>rulinux.net - Форум - Development - [Глупый вопрос] Проскакивает getchar()</title>
<link>http://rulinux.net/</link>
<url>http://rulinux.net/rss_icon.png</url>
</image>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32918</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32918</guid>
<pubDate>Fri, 04 Dec 2009 19:15:08 +0300</pubDate>
<description><![CDATA[<p>Спасибо тебе анонимус, а то я такой велосипед сваял, что рассказывать стыдно :)</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32917</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32917</guid>
<pubDate>Fri, 04 Dec 2009 16:34:04 +0300</pubDate>
<description><![CDATA[<p>The  function fpurge() clears the buffers of the given stream.  For output streams this discards any unwritten output.  For input streams this discards any input read from the underlying object but not yet obtained via getc(3); this  includes  any text pushed back via ungetc(3).  See also fflush(3).</p><p>Вот, пользуйся.</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32916</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32916</guid>
<pubDate>Fri, 04 Dec 2009 16:00:33 +0300</pubDate>
<description><![CDATA[<p>Бля, чё за тупая подсветка кода? Синий printf на синем фоне...</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32915</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32915</guid>
<pubDate>Sun, 22 Nov 2009 13:29:12 +0300</pubDate>
<description><![CDATA[<p><i>>Это нормальное поведение для функции?</i><br></p><p>Вряд ли.</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32914</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32914</guid>
<pubDate>Sun, 22 Nov 2009 12:01:37 +0300</pubDate>
<description><![CDATA[<p>да. Прекращай заниматься быдлокодингом.</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32913</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32913</guid>
<pubDate>Sat, 21 Nov 2009 15:16:15 +0300</pubDate>
<description><![CDATA[<p>\n попадает в stdin после вызова scanf(&quot;%i&quot;, &amp;selection);</p><p>Это нормальное поведение для функции?</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32912</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32912</guid>
<pubDate>Sat, 21 Nov 2009 15:03:33 +0300</pubDate>
<description><![CDATA[<p><i>> исправил на такой вариант и все стало нормально</i><br> Наврал. Забыл что для тестирования поставил в функцию 2 getchar()</p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32911</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32911</guid>
<pubDate>Sat, 21 Nov 2009 14:57:40 +0300</pubDate>
<description><![CDATA[<p>Вот где собака зарыта: </p><p><fieldset><legend>c</legend><code><br />
&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;some string.<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Один из символов \n почему-то попал в stdin</span><br />
&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;somestring.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// исправил на такой вариант и все стало нормально</span><br />
&nbsp;</code></fieldset></p>]]></description>
</item>
<item>
<title>Re: [Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32910</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32910</guid>
<pubDate>Sat, 21 Nov 2009 13:27:21 +0300</pubDate>
<description><![CDATA[<p>Алсо, в проге часто вызываются printf() и scanf()</p>]]></description>
</item>
<item>
<title>[Глупый вопрос] Проскакивает getchar()</title>
<link>https://rulinux.net/message.php?newsid=5219&amp;page=1#32909</link>
<guid>https://rulinux.net/message.php?newsid=5219&amp;page=1#32909</guid>
<pubDate>Sat, 21 Nov 2009 13:18:00 +0300</pubDate>
<description><![CDATA[<p>Есть сферическая функция в вакууме: </p><p><fieldset><legend>c</legend><code><br />
<span style="color: #993333;">void</span> pressEnter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Press Enter.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; getchar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;</code></fieldset></p><p>Эта функция проскакивает не дожидаясь нажатия Enter с клавиатуры. getchar() возвращает 10 (это ЕМНИП и есть Enter).</p><p>Сабж: Откуда этот Enter появляется, и как избежать подобного поведения?</p>]]></description>
</item>
</channel>
</rss>