<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[std::cin Probleme Konsole]]></title><description><![CDATA[<p>Hi Leute</p>
<p>ich bin gerade dabei die Konsole eines Servers weiterzuentwickeln.</p>
<p>Habe hier mal den relevanten Code aufgelistet:</p>
<p><strong>Die Kommandoschleife:</strong></p>
<pre><code class="language-cpp">while ( !QuitServer )
{
    cout &lt;&lt; &quot;&gt;&quot;;
    cin &gt;&gt; Command;
    cout &lt;&lt; endl;
    QuitServer = ProcessCommands( Command );
}
</code></pre>
<p><strong>Hier die Kommandoverarbeitung:</strong></p>
<pre><code class="language-cpp">bool Cfoobarklasse::ProcessCommands( string &amp;Command )
{
    if ( Command == &quot;?&quot; )
    {
        ...
    }
    ...
    if ( Command.find( &quot;addshare&quot; ) == 0 )
    {
        Ctextparser tp( Command, &quot; &quot; );
	if ( ( tp.GetString(0) == &quot;addshare&quot; ) &amp;&amp; ( tp.GetAnzStrings() == 2 ) )
	{
	    if ( ( tp.GetString(1) == &quot;?&quot; ) || ( tp.GetString(1) == &quot;--help&quot; ))
            {
                 ...
            }
        } 
    }
    ...
}
</code></pre>
<p>Edit: entschuldigt bitte die nicht ganz perfekte Formatierung, aber scheinbar ist das Ding hier nicht in der Lage, den Cpp-Code so darzustellen wie ich ihn hier ein getippelt habe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Der Befehl &quot;addshare&quot; soll noch einen Parameter ermöglichen. Also z.B. &quot;--help&quot; oder &quot;?&quot;, bzw. auch die ein richtiger Parameter.</p>
<p>Wenn ich jetzt allerdings &quot;addshare ?&quot; eingebe, dann wird die Befehlsfolge nicht so interpretiert wie ich mir das dachte. Eigentlich sollte die &quot;Hilfe&quot; zum Befehl &quot;addshare&quot; erscheinen.</p>
<p>Jedoch wird der Befehl &quot;addshare ?&quot; anders interpretiert.</p>
<p>Einmal wird &quot;addshare&quot; verarbeitet und darauf hin &quot;?&quot; unabhängig davon, als hätte ich die zwei Befehle getrennt eingegeben.</p>
<p>Die Funktion &quot;ProcessCommands&quot; wird auch tatsächlich zweimal aufgerufen, weil &quot;cin &gt;&gt; Commands&quot; das Leerzeichen zwischen &quot;addshare&quot; und &quot;?&quot; ganz offensichtlich als Trenner interpretiert.</p>
<p>Warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/246757/std-cin-probleme-konsole</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 21:25:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/246757.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Aug 2009 09:33:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::cin Probleme Konsole on Sat, 01 Aug 2009 09:37:07 GMT]]></title><description><![CDATA[<p>Hi Leute</p>
<p>ich bin gerade dabei die Konsole eines Servers weiterzuentwickeln.</p>
<p>Habe hier mal den relevanten Code aufgelistet:</p>
<p><strong>Die Kommandoschleife:</strong></p>
<pre><code class="language-cpp">while ( !QuitServer )
{
    cout &lt;&lt; &quot;&gt;&quot;;
    cin &gt;&gt; Command;
    cout &lt;&lt; endl;
    QuitServer = ProcessCommands( Command );
}
</code></pre>
<p><strong>Hier die Kommandoverarbeitung:</strong></p>
<pre><code class="language-cpp">bool Cfoobarklasse::ProcessCommands( string &amp;Command )
{
    if ( Command == &quot;?&quot; )
    {
        ...
    }
    ...
    if ( Command.find( &quot;addshare&quot; ) == 0 )
    {
        Ctextparser tp( Command, &quot; &quot; );
	if ( ( tp.GetString(0) == &quot;addshare&quot; ) &amp;&amp; ( tp.GetAnzStrings() == 2 ) )
	{
	    if ( ( tp.GetString(1) == &quot;?&quot; ) || ( tp.GetString(1) == &quot;--help&quot; ))
            {
                 ...
            }
        } 
    }
    ...
}
</code></pre>
<p>Edit: entschuldigt bitte die nicht ganz perfekte Formatierung, aber scheinbar ist das Ding hier nicht in der Lage, den Cpp-Code so darzustellen wie ich ihn hier ein getippelt habe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Der Befehl &quot;addshare&quot; soll noch einen Parameter ermöglichen. Also z.B. &quot;--help&quot; oder &quot;?&quot;, bzw. auch die ein richtiger Parameter.</p>
<p>Wenn ich jetzt allerdings &quot;addshare ?&quot; eingebe, dann wird die Befehlsfolge nicht so interpretiert wie ich mir das dachte. Eigentlich sollte die &quot;Hilfe&quot; zum Befehl &quot;addshare&quot; erscheinen.</p>
<p>Jedoch wird der Befehl &quot;addshare ?&quot; anders interpretiert.</p>
<p>Einmal wird &quot;addshare&quot; verarbeitet und darauf hin &quot;?&quot; unabhängig davon, als hätte ich die zwei Befehle getrennt eingegeben.</p>
<p>Die Funktion &quot;ProcessCommands&quot; wird auch tatsächlich zweimal aufgerufen, weil &quot;cin &gt;&gt; Commands&quot; das Leerzeichen zwischen &quot;addshare&quot; und &quot;?&quot; ganz offensichtlich als Trenner interpretiert.</p>
<p>Warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753386</guid><dc:creator><![CDATA[It0101]]></dc:creator><pubDate>Sat, 01 Aug 2009 09:37:07 GMT</pubDate></item><item><title><![CDATA[Reply to std::cin Probleme Konsole on Sat, 01 Aug 2009 09:41:38 GMT]]></title><description><![CDATA[<p>Für das was Du machen willst, nimmt man typischerweise <code>std::getline</code> .<br />
Zur Arbeitsweise von <code>std::istream::operator&gt;&gt;(...)</code> guck das mal <a href="http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E/" rel="nofollow">das hier</a> an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753393</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Sat, 01 Aug 2009 09:41:38 GMT</pubDate></item><item><title><![CDATA[Reply to std::cin Probleme Konsole on Sat, 01 Aug 2009 09:46:20 GMT]]></title><description><![CDATA[<p>Danke, funzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753395</guid><dc:creator><![CDATA[It0101]]></dc:creator><pubDate>Sat, 01 Aug 2009 09:46:20 GMT</pubDate></item></channel></rss>