<?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[Bei Umlauten läuft die Anwendung Amok!]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Programm (gekürtzt):</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

int main(void)
{
  bool exit = false;

  while(exit == false)
  {
    std::string input;
    std::cin &gt;&gt; input;
    std::cout &lt;&lt; input &lt;&lt; std::endl;

    if(input == &quot;exit&quot;)
    {
      exit = true;
    }
  }

  return 0;
}
</code></pre>
<p>Wenn ich das jetzt teste klappt alles einwandfrei. Sobald ich aber umlaute eingebe spielt die Anwendung entweder verrückt oder ich kann eingegeben was ich will ohne das es einen effekt hat. d.h. wenn ich 'exit' eingebe passiert gar nichts...</p>
<p>Kann mir jemand sagen wie ich dieses problem behebe?</p>
<p>Gruß, Prophet05</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/170260/bei-umlauten-läuft-die-anwendung-amok</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 01:01:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/170260.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 Jan 2007 15:49:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 15:50:28 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Programm (gekürtzt):</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;iostream&gt;

int main(void)
{
  bool exit = false;

  while(exit == false)
  {
    std::string input;
    std::cin &gt;&gt; input;
    std::cout &lt;&lt; input &lt;&lt; std::endl;

    if(input == &quot;exit&quot;)
    {
      exit = true;
    }
  }

  return 0;
}
</code></pre>
<p>Wenn ich das jetzt teste klappt alles einwandfrei. Sobald ich aber umlaute eingebe spielt die Anwendung entweder verrückt oder ich kann eingegeben was ich will ohne das es einen effekt hat. d.h. wenn ich 'exit' eingebe passiert gar nichts...</p>
<p>Kann mir jemand sagen wie ich dieses problem behebe?</p>
<p>Gruß, Prophet05</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209270</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209270</guid><dc:creator><![CDATA[Prophet05]]></dc:creator><pubDate>Sat, 13 Jan 2007 15:50:28 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:07:47 GMT]]></title><description><![CDATA[<p>ich nenne dir einfach mal 2 stichpunkte:<br />
wchar_t und basic_string</p>
<p>wobei wchar_t ein datentyp und basic_string ein template ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209274</guid><dc:creator><![CDATA[ConfusedGuy]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:07:47 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:10:40 GMT]]></title><description><![CDATA[<p>codepage</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209276</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:10:40 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:19:51 GMT]]></title><description><![CDATA[<p>also bei mir klappt alles ohne probleme. möglicherweise stecken noch einige zeichen im tastaturpuffer. abhilfe würde schaffen:</p>
<pre><code class="language-cpp">fflush(stdin)
</code></pre>
<p>oder noch besser jedes zeichen aus dem puffer ziehn bis du auf ein &quot;\n&quot; stösst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209282</guid><dc:creator><![CDATA[bill bones]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:19:51 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:27:19 GMT]]></title><description><![CDATA[<p>das klingt aber sehr nach c...warum auf einmal c in c++ einbauen? das ist völlig unnötig. nimm</p>
<pre><code class="language-cpp">cin.sync();//eingabepuffe löschen
cin.clear();//fehlerzustände beseitigen
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1209287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209287</guid><dc:creator><![CDATA[ConfusedGuy]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:27:19 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:47:20 GMT]]></title><description><![CDATA[<p>ConfusedGuy schrieb:</p>
<blockquote>
<p>ich nenne dir einfach mal 2 stichpunkte:<br />
wchar_t und basic_string</p>
<p>wobei wchar_t ein datentyp und basic_string ein template ist.</p>
</blockquote>
<p>Was issen das für ein Tip? Sag ihm doch gleich, er soll std::wstring benutzen und die dazugehörige std::wcin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209299</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:47:20 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 16:59:38 GMT]]></title><description><![CDATA[<p>jup, hatte ich vergessen. ruhig blut..<br />
naja, vielleicht versteht er jetzt warum es nicht funktioniert hat</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209307</guid><dc:creator><![CDATA[ConfusedGuy]]></dc:creator><pubDate>Sat, 13 Jan 2007 16:59:38 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sat, 13 Jan 2007 17:19:11 GMT]]></title><description><![CDATA[<p>Vielen dank für eure hilfe. Ich habe beide varianten ausprobiert. mit sync und clear hat es geklappt. Als ich es mit wstring und wcin versucht habe ist das programm wieder amok gelaufen. Muss ich da auch clear und sync aufrufen?</p>
<p>Nun zu einem anderen Programm was ähnliche probleme hat. Ich habe mit hilfe der Base Bibliothek von wxWidgets geschrieben. Das problem war das dort keine schnittstelle für die C++ Streams vorhanden ist. Also habe ich die dort integrierten c funktionen verwendet um an die daten zu kommen. Ziel des Programms ist es das ich während der eingabe durch den anwender andere dinge machen kann. Bis jetzt sieht es so aus:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &lt;wx/string.h&gt;
#include &lt;wx/utils.h&gt;

bool ValidCommandChar(wxChar c)
{
	return !wxIscntrl(c);
}

int main(void)
{
	// when the application shall exit this is set to true.
	bool Exit = false;

	// Contains all characters from input that do not form a complete 
	// command yet.
	wxString ReadBuffer;

	// Contains a completed command if availible.
	wxString CurrentCommand;

	// Application loop.
	while(Exit == false)
	{
		// Character buffer for reading input.
		wxChar Buffer;

		// Reset CurrentCommand so that no commands from last loop are procesed.		
		CurrentCommand = wxT(&quot;&quot;);

		// Read a char from the standard input.
		Buffer = (wxChar)wxFgetc(stdin);

		// If the char is a newline (command termination)
		if(Buffer == (wxChar)wxT('\n'))
		{
			// The CurrentCommand is set.
			CurrentCommand = ReadBuffer;
			// And the ReadBuffer is cleared.
			ReadBuffer = wxT(&quot;&quot;);
		}
		// else add the char to the read buffer as long it is a valid command char.
		else if(ValidCommandChar(Buffer))
		{
			// Add it to the ReadBuffer.
			ReadBuffer += Buffer;
		}

		// Do something else.
		wxMicroSleep(1000);

		// If &quot;exit&quot; is the command, then quit the application.
		if(CurrentCommand == wxT(&quot;exit&quot;))
		{
			Exit = true;
		}
	}

	return 0;
}
</code></pre>
<p>Dort gibt es das selbe problem mit umlauten. Ich verwende die Unicode Variante der bibliothek das heißt es sollte dort theoretisch keine probleme geben. Allerdings ist wxFgetc nur eine weiterleitung auf die alte c funktion. Daher vermute ich das problem dort. Ich habe auch versucht fflush(stdin) im anschluss aufzurufen aber das hat nichts gebracht außer das der fehler noch schlimmer wurde. ich hoffe ihr könnt mir auch hiermit helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209312</guid><dc:creator><![CDATA[Prophet05]]></dc:creator><pubDate>Sat, 13 Jan 2007 17:19:11 GMT</pubDate></item><item><title><![CDATA[Reply to Bei Umlauten läuft die Anwendung Amok! on Sun, 14 Jan 2007 22:41:15 GMT]]></title><description><![CDATA[<p>Ich pushe den Post jetzt mal in der Hoffnung das mir noch jemand helfen kann. Vielleicht entspricht der letzte Post auch nicht mehr ganz dem Topic dieses Forums. Wäre also nett wenn es entsprechend verschoben wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1209965</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1209965</guid><dc:creator><![CDATA[Prophet05]]></dc:creator><pubDate>Sun, 14 Jan 2007 22:41:15 GMT</pubDate></item></channel></rss>