<?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[Eingabetaste einlesen wie???]]></title><description><![CDATA[<p>Hallo wie lass ich bzw ein beispiel:ich schreibe einen text in ein textdokument rein und will das mit der Eingabetaste beenden wie mach ich das ?? Vielen dank für eure Antworten im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/177876/eingabetaste-einlesen-wie</link><generator>RSS for Node</generator><lastBuildDate>Tue, 23 Jun 2026 23:37:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177876.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Apr 2007 19:34:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 19:34:39 GMT]]></title><description><![CDATA[<p>Hallo wie lass ich bzw ein beispiel:ich schreibe einen text in ein textdokument rein und will das mit der Eingabetaste beenden wie mach ich das ?? Vielen dank für eure Antworten im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259536</guid><dc:creator><![CDATA[Massiv]]></dc:creator><pubDate>Wed, 04 Apr 2007 19:34:39 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 19:57:12 GMT]]></title><description><![CDATA[<p>Was hast du schon für code geschrieben?<br />
Was für ein Ergebnis willst du erzielen?<br />
An welcher stelle treten denn probleme auf?<br />
Was hast du mit den ganzen Punkten und Kommatas gemacht^^? <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/1259566</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259566</guid><dc:creator><![CDATA[Andrey]]></dc:creator><pubDate>Wed, 04 Apr 2007 19:57:12 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 19:57:17 GMT]]></title><description><![CDATA[<p>Hi !<br />
Hier ist eine Anregung:</p>
<pre><code>#include &lt;fstream&gt;
#include &lt;conio.h&gt; // getche
using namespace std;

int main()
{
	ofstream ofs;
	char c;

	ofs.open( &quot;Eingabe.txt&quot;  );

	if(!ofs)
	{
		return 0;
	}

	while ( ( c = getche() ) != 13  )
	{
		ofs.put( c );
	}

	ofs.close();
	return 0;
}
</code></pre>
<p>Mit getche() siehst du bereits während der Eingabe, was in die Datei geht.<br />
Gruß,<br />
p.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259568</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259568</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Wed, 04 Apr 2007 19:57:17 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 20:40:34 GMT]]></title><description><![CDATA[<p>ja danke proggingmania also ich werds mal so machn<br />
zu meinem code der code ist in c aber ist ja fast identisch mit c++<br />
das eingegebene darf nicht auf dem bildschirm erscheinen<br />
Inkremente und exkremente hab ich mal ausgelassen <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="🙂"
    /><br />
zum code:</p>
<p>...</p>
<p>int x=0;<br />
char a,password[80],kontrolle[]=&quot;hallo&quot;;</p>
<p>while(x)<br />
{<br />
a=getch();<br />
if(a!=EINGABETASTE) //also hier wie mach ich das bei eingabetaste zu else<br />
{<br />
printf(&quot;* &quot;);<br />
password[x]==a;<br />
x++;<br />
}<br />
else<br />
{<br />
x=0;<br />
}<br />
}</p>
<p>if(strcmp(password,kontrolle)==0)<br />
printf(&quot;Passwort korrekt&quot;);<br />
else<br />
printf(&quot;Passwort falsch&quot;);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259599</guid><dc:creator><![CDATA[Massiv]]></dc:creator><pubDate>Wed, 04 Apr 2007 20:40:34 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 20:51:17 GMT]]></title><description><![CDATA[<p>Also die 13 ist die eingabetaste danke also muss ich schreiben if(x!=13) Vielen dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259604</guid><dc:creator><![CDATA[Massiv]]></dc:creator><pubDate>Wed, 04 Apr 2007 20:51:17 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 20:59:58 GMT]]></title><description><![CDATA[<p>In C geht das natürlich auch.<br />
Ich würd aber nicht buchstabenweise einlesen, sondern gleich den gleichen String:</p>
<pre><code>#include &lt;stdio.h&gt;

int main ()
{
	char* kontrolle = &quot;Hallo&quot;;
	char passwort[80+1];
	while( strcmp( kontrolle, passwort ) != 0 )
	{
		printf(&quot;\nPasswort eingeben: &quot; );
		scanf( &quot;%80s&quot;, passwort );
	}
	return 0;
}
</code></pre>
<p>Vielleicht noch eine Begrenzung der Anzahl der Eingabeversuche begrenzen.<br />
Gruß,<br />
p.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259607</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Wed, 04 Apr 2007 20:59:58 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 21:06:07 GMT]]></title><description><![CDATA[<p>aber dann erscheint das doch aufm bildschrim oder der string ich will ja pro eingetippenem buchstabe ein &quot;*&quot; einblenden lassen sry wenn ich falsch liege aber du hast mir sehr geholfen danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259610</guid><dc:creator><![CDATA[Massiv]]></dc:creator><pubDate>Wed, 04 Apr 2007 21:06:07 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Wed, 04 Apr 2007 21:36:20 GMT]]></title><description><![CDATA[<p>Ja, verstehe, war wohl grade n bisschen müde.<br />
Hat ja was mit den '*' Zeichen. <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>Ich würd da noch ein bisschen Kosmetik reinmachen:<br />
Abbruchbedingungen:</p>
<p>- Maximale Anzahl der Buchstaben fürs Passwort begrenzen, z.B. 20,<br />
denn sonst riskierst du einen Programmabsturz bei Überlauf.</p>
<p>- Anzahl der Versuche begrenzen z.B. 3<br />
- Wenn Passwort OK, gleich raus aus der Schleife</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;string.h&gt;

int main ()
{
	  char c=0;
	  int len = 0, max_len = 20;
	  char passwort[20+1];
	  char* kontrolle = &quot;Hallo&quot;;
	  int iIstVersuche = 0, iMaxVersuche = 3;

	  do
	  {
		  len = 0;
		  memset( passwort, '\0', max_len );
		  while ( ( ( c = getch() ) != 13 ) &amp;&amp; ( len &lt; max_len ) )
		  {
				printf(&quot;*&quot;);
				passwort[len++] = c;
		  }

		  if ( strcmp( passwort, kontrolle ) == 0 ) 
		  {
			  puts (&quot; Passwort OK&quot;);
			  break;
		  }

		  else 
		  {
			puts(&quot; Passwort falsch&quot;);
			iIstVersuche++;
		  }

	  }while ( iIstVersuche &lt; iMaxVersuche );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1259622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259622</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Wed, 04 Apr 2007 21:36:20 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabetaste einlesen wie??? on Thu, 05 Apr 2007 10:32:57 GMT]]></title><description><![CDATA[<p>ja danke für die tipps</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259906</guid><dc:creator><![CDATA[Massiv]]></dc:creator><pubDate>Thu, 05 Apr 2007 10:32:57 GMT</pubDate></item></channel></rss>