<?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[Unendliche Schleife nach cin]]></title><description><![CDATA[<p>Ich habe schon verschiedene Beiträge darüber gelesen und alles ausprobiert, aber es funktioniert trotzdem nicht,ich hoffe ihr könnt mir helfen.<br />
Das heißt ich kann zwar etwas eingeben aber der Cursor geht einfach nur eine zeile weiter runter.</p>
<p>System: Linux x64 (Ubuntu)</p>
<pre><code>int menu(){
char a1[]=&quot;ab1c2a&quot;;
char a2[]=&quot;ab1c2b&quot;;
char a3[]=&quot;ab1c2c&quot;;
char a4[]=&quot;ab1c2d&quot;;
char a5[]=&quot;ab1c2e&quot;;

char b1[]=&quot;bc1d1a&quot;;
char b2[]=&quot;bc1d1b&quot;;
char b3[]=&quot;bc1d1c&quot;;
char b4[]=&quot;bc1d1d&quot;;
char b5[]=&quot;bc1d1e&quot;;
char b6[]=&quot;bc1d1f&quot;;
char b7[]=&quot;bc1d1g&quot;;

char c1[]=&quot;cd1e1a&quot;;
char c2[]=&quot;cd1e1b&quot;;

char *args[]={&quot;Anl&quot;,&quot;qz5ns83&quot;,&quot;&quot;,NULL};
char wahl[10]={0};
bool ok=0;
cout&lt;&lt;&quot;\033[2J\033[H&quot;;
cout&lt;&lt;&quot;\033]0;MediaCenter\007&quot;
&lt;&lt;endl
&lt;&lt;&quot;MediaCenter\n&quot;
&lt;&lt;endl
&lt;&lt;&quot; - Optionen -\n&quot;
&lt;&lt;endl
&lt;&lt;&quot;    \&quot;st\&quot; CMD\n\n&quot;
&lt;&lt;&quot;    \&quot;dem\&quot; Demo\n\n&quot;
&lt;&lt;&quot;    \&quot;re\&quot; Rechner\n\n&quot;
&lt;&lt;&quot;    \&quot;x\&quot; Beenden\n\n&quot;
&lt;&lt;&quot;Wahl eingeben: &quot;;
cin&gt;&gt;wahl;//HIER!!!
if(!strcmp(wahl,&quot;1&quot;)){args[2]=a1;ok=1;}
if(!strcmp(wahl,&quot;2&quot;)){args[2]=a2;ok=1;}
if(!strcmp(wahl,&quot;note&quot;)){args[2]=b2;ok=1;}
if(!strcmp(wahl,&quot;htm&quot;)){args[2]=b3;ok=1;}
if(!strcmp(wahl,&quot;sh&quot;)){args[2]=b4;ok=1;}
if(!strcmp(wahl,&quot;cl&quot;)){args[2]=b5;ok=1;}
if(!strcmp(wahl,&quot;start&quot;)){args[2]=b6;ok=1;}
if(!strcmp(wahl,&quot;moun1&quot;)){args[2]=c1;ok=1;}
if(!strcmp(wahl,&quot;moun2&quot;)){args[2]=c2;ok=1;}
if(!strcmp(wahl,&quot;dis&quot;)){}
if(!strcmp(wahl,&quot;An&quot;)){args[2]=0;ok=1;}
if(!strcmp(wahl,&quot;dem&quot;)){}
if(!strcmp(wahl,&quot;re&quot;)){}
if(!strcmp(wahl,&quot;del&quot;)){args[2]=b7;ok=1;}
if(!strcmp(wahl,&quot;x&quot;))return 0;
cout&lt;&lt;&quot;schon hier&quot;;
if(ok)execv(&quot;/home/user/MediaCenter/Anl&quot;, args);
else{
cout&lt;&lt;&quot;\033[2J\033[H&quot;;
menu();
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/326791/unendliche-schleife-nach-cin</link><generator>RSS for Node</generator><lastBuildDate>Mon, 25 May 2026 12:54:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/326791.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Jul 2014 17:24:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 17:40:44 GMT]]></title><description><![CDATA[<p>Ich habe schon verschiedene Beiträge darüber gelesen und alles ausprobiert, aber es funktioniert trotzdem nicht,ich hoffe ihr könnt mir helfen.<br />
Das heißt ich kann zwar etwas eingeben aber der Cursor geht einfach nur eine zeile weiter runter.</p>
<p>System: Linux x64 (Ubuntu)</p>
<pre><code>int menu(){
char a1[]=&quot;ab1c2a&quot;;
char a2[]=&quot;ab1c2b&quot;;
char a3[]=&quot;ab1c2c&quot;;
char a4[]=&quot;ab1c2d&quot;;
char a5[]=&quot;ab1c2e&quot;;

char b1[]=&quot;bc1d1a&quot;;
char b2[]=&quot;bc1d1b&quot;;
char b3[]=&quot;bc1d1c&quot;;
char b4[]=&quot;bc1d1d&quot;;
char b5[]=&quot;bc1d1e&quot;;
char b6[]=&quot;bc1d1f&quot;;
char b7[]=&quot;bc1d1g&quot;;

char c1[]=&quot;cd1e1a&quot;;
char c2[]=&quot;cd1e1b&quot;;

char *args[]={&quot;Anl&quot;,&quot;qz5ns83&quot;,&quot;&quot;,NULL};
char wahl[10]={0};
bool ok=0;
cout&lt;&lt;&quot;\033[2J\033[H&quot;;
cout&lt;&lt;&quot;\033]0;MediaCenter\007&quot;
&lt;&lt;endl
&lt;&lt;&quot;MediaCenter\n&quot;
&lt;&lt;endl
&lt;&lt;&quot; - Optionen -\n&quot;
&lt;&lt;endl
&lt;&lt;&quot;    \&quot;st\&quot; CMD\n\n&quot;
&lt;&lt;&quot;    \&quot;dem\&quot; Demo\n\n&quot;
&lt;&lt;&quot;    \&quot;re\&quot; Rechner\n\n&quot;
&lt;&lt;&quot;    \&quot;x\&quot; Beenden\n\n&quot;
&lt;&lt;&quot;Wahl eingeben: &quot;;
cin&gt;&gt;wahl;//HIER!!!
if(!strcmp(wahl,&quot;1&quot;)){args[2]=a1;ok=1;}
if(!strcmp(wahl,&quot;2&quot;)){args[2]=a2;ok=1;}
if(!strcmp(wahl,&quot;note&quot;)){args[2]=b2;ok=1;}
if(!strcmp(wahl,&quot;htm&quot;)){args[2]=b3;ok=1;}
if(!strcmp(wahl,&quot;sh&quot;)){args[2]=b4;ok=1;}
if(!strcmp(wahl,&quot;cl&quot;)){args[2]=b5;ok=1;}
if(!strcmp(wahl,&quot;start&quot;)){args[2]=b6;ok=1;}
if(!strcmp(wahl,&quot;moun1&quot;)){args[2]=c1;ok=1;}
if(!strcmp(wahl,&quot;moun2&quot;)){args[2]=c2;ok=1;}
if(!strcmp(wahl,&quot;dis&quot;)){}
if(!strcmp(wahl,&quot;An&quot;)){args[2]=0;ok=1;}
if(!strcmp(wahl,&quot;dem&quot;)){}
if(!strcmp(wahl,&quot;re&quot;)){}
if(!strcmp(wahl,&quot;del&quot;)){args[2]=b7;ok=1;}
if(!strcmp(wahl,&quot;x&quot;))return 0;
cout&lt;&lt;&quot;schon hier&quot;;
if(ok)execv(&quot;/home/user/MediaCenter/Anl&quot;, args);
else{
cout&lt;&lt;&quot;\033[2J\033[H&quot;;
menu();
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2407453</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407453</guid><dc:creator><![CDATA[Sol64]]></dc:creator><pubDate>Mon, 07 Jul 2014 17:40:44 GMT</pubDate></item><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 17:40:47 GMT]]></title><description><![CDATA[<p>Der Code denn du angeben hast reicht nicht aus um denn Fehler zu finden, weil die Schleife fehlt. Außerdem hat dein Code mehr mit C als mit C++ zu tun.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407458</guid><dc:creator><![CDATA[theconflict]]></dc:creator><pubDate>Mon, 07 Jul 2014 17:40:47 GMT</pubDate></item><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 17:43:31 GMT]]></title><description><![CDATA[<p>Welche Schleife?<br />
Meinst du</p>
<pre><code>int main(){
menu();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2407459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407459</guid><dc:creator><![CDATA[Sol64]]></dc:creator><pubDate>Mon, 07 Jul 2014 17:43:31 GMT</pubDate></item><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 18:41:47 GMT]]></title><description><![CDATA[<p>Und was für einen Eingabe führt zu einem Fehler?<br />
Du zerschiesst Dir natürlich Speicher, wenn Du mehr als 9 Zeichen eingibst...Kann Sein, dass das zu merkwürdigen Ergebnissen führt. Wenn Du <code>getline()</code> (member von <code>cin</code> ) nimmst kannst Du wenigstens die Maximallänge angeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407469</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Mon, 07 Jul 2014 18:41:47 GMT</pubDate></item><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 20:30:08 GMT]]></title><description><![CDATA[<p>Gelöst mit:</p>
<pre><code>cin.clear();
cin.sync();
cin&gt;&gt;wahl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2407494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407494</guid><dc:creator><![CDATA[Sol64]]></dc:creator><pubDate>Mon, 07 Jul 2014 20:30:08 GMT</pubDate></item><item><title><![CDATA[Reply to Unendliche Schleife nach cin on Mon, 07 Jul 2014 20:41:17 GMT]]></title><description><![CDATA[<p>Sol64 schrieb:</p>
<blockquote>
<p>Gelöst mit:</p>
<pre><code>cin.clear();
cin.sync();
cin&gt;&gt;wahl;
</code></pre>
</blockquote>
<p>&quot;Gelöst&quot; bedeutet in dem Fall eher &quot;Mit Kaugummi und Tesafilm repariert&quot;. Die eigentliche Ursache ist eine andere (vermutlich das Übliche: Fehlende Fehlerbehandlung) und diese Lösung verlässt sich auf nicht-standardisierte Eigenschaften einer einzigen, ganz bestimmten C++-Laufzeitumgebung und wird daher nicht portabel funktionieren. Und du lernst nicht einmal, wie es richtig geht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407496</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Jul 2014 20:41:17 GMT</pubDate></item></channel></rss>