<?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[&amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot;]]></title><description><![CDATA[<p>HI,<br />
ich habe folgendes Problem...<br />
In meinem Programm, soll strlen die Länge eines Strings bestimmen, hört aber bei Leerzeichen auf zu &quot;zählen&quot;, weiß einer von euch warum, oder wieso?</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;stdio.h&quot;
#include &quot;iostream&quot;
using namespace std;

void main()
{
	char c;
	char string[100];
	char string_help[100];
	double laenge;
	int i = 0;
	int x = 0;

	printf (&quot;Eingabe: &quot;);
	fflush(stdin);
	cin &gt;&gt; string;
	laenge = strlen(string );

	for (i=0; i&lt;= laenge; i++)
	{
		fflush(stdin);
		c = string[i];

		if (c &gt;= 'a' &amp;&amp; c &lt;= 'z' || c &gt;= 'A' &amp;&amp; c &lt;= 'Z' || c == '\\' || c == '.' || c == ':' || c == ' ' || c &gt;= '0' &amp;&amp; c &lt;= '9' || c == '_')
		{
			string_help[x] = c;
			x++; 
		}
	}

	string_help[x] = '\0';

	cout &lt;&lt; &quot;Ausgabe (korrigier): &quot;;
	cout &lt;&lt; string_help;
	fflush(stdin);
	getchar();
}
</code></pre>
<p>Greetz<br />
Die Eule</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/191356/quot-strlen-quot-hört-ab-leerzeichen-auf-zu-quot-zählen-quot</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 23:10:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/191356.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 02 Sep 2007 00:14:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 00:14:03 GMT]]></title><description><![CDATA[<p>HI,<br />
ich habe folgendes Problem...<br />
In meinem Programm, soll strlen die Länge eines Strings bestimmen, hört aber bei Leerzeichen auf zu &quot;zählen&quot;, weiß einer von euch warum, oder wieso?</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;stdio.h&quot;
#include &quot;iostream&quot;
using namespace std;

void main()
{
	char c;
	char string[100];
	char string_help[100];
	double laenge;
	int i = 0;
	int x = 0;

	printf (&quot;Eingabe: &quot;);
	fflush(stdin);
	cin &gt;&gt; string;
	laenge = strlen(string );

	for (i=0; i&lt;= laenge; i++)
	{
		fflush(stdin);
		c = string[i];

		if (c &gt;= 'a' &amp;&amp; c &lt;= 'z' || c &gt;= 'A' &amp;&amp; c &lt;= 'Z' || c == '\\' || c == '.' || c == ':' || c == ' ' || c &gt;= '0' &amp;&amp; c &lt;= '9' || c == '_')
		{
			string_help[x] = c;
			x++; 
		}
	}

	string_help[x] = '\0';

	cout &lt;&lt; &quot;Ausgabe (korrigier): &quot;;
	cout &lt;&lt; string_help;
	fflush(stdin);
	getchar();
}
</code></pre>
<p>Greetz<br />
Die Eule</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357119</guid><dc:creator><![CDATA[Die Eule]]></dc:creator><pubDate>Sun, 02 Sep 2007 00:14:03 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 00:33:19 GMT]]></title><description><![CDATA[<p>Zwei Sachen ;):<br />
- &quot;cin&quot; liest nur bis zum Leerzeichen ein<br />
- Die einzelnen &quot;a&amp;&amp;b&quot; in der langen if-Bedingung würde ich einklammern</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357123</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 02 Sep 2007 00:33:19 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 08:56:55 GMT]]></title><description><![CDATA[<p>das ist c++ und kein ansi c <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357154</guid><dc:creator><![CDATA[lames]]></dc:creator><pubDate>Sun, 02 Sep 2007 08:56:55 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 09:57:36 GMT]]></title><description><![CDATA[<p>Und bei fflush(stdin) kommt es zu undefinierten verhalten...<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-p-is-1146014.html" rel="nofollow">klick mich</a></p>
<p>Gruß<br />
zeigerzeiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357172</guid><dc:creator><![CDATA[zeigerzeiger]]></dc:creator><pubDate>Sun, 02 Sep 2007 09:57:36 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 11:17:26 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-14811.html" rel="nofollow">Tim</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-10.html" rel="nofollow">ANSI C</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357209</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sun, 02 Sep 2007 11:17:26 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 11:34:59 GMT]]></title><description><![CDATA[<p>Ehm und for (i=0; i&lt;= laenge; i++) macht aua ^^ muss i &lt; laenge heißen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> bzw das macht nicht aua aber string[laenge] ist immer '\0' == 0.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357222</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357222</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 02 Sep 2007 11:34:59 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 11:42:18 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;limits&gt;
using namespace std;

void clear_stream(istream&amp; in)
{
    in.clear();
    in.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n');
}

int main()
{
    char eingabe[100];
    char ausgabe[100];
    char c = 0;
    size_t j = 0;

    cout &lt;&lt; &quot;Eingabe: &quot;;
    cin &gt;&gt; eingabe;
    clear_stream(cin);

    for(size_t i = 0; i &lt; strlen(eingabe); ++i)
    {
        c = eingabe[i];

        if ((c &gt;= 'a' &amp;&amp; c &lt;= 'z') ||
            (c &gt;= 'A' &amp;&amp; c &lt;= 'Z') ||
            c == '\\' ||
            c == '.' ||
            c == ':' ||
            c == ' ' ||
            (c &gt;= '0' &amp;&amp; c &lt;= '9') ||
            c == '_')
        {
            ausgabe[j] = c;
            ++j;
        }
    }

    ausgabe[j] = '\0';
    cout &lt;&lt; &quot;Ausgabe: &quot; &lt;&lt; ausgabe &lt;&lt; std::endl;
    cin.get();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1357230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357230</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Sun, 02 Sep 2007 11:42:18 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;strlen&amp;quot; hört ab LEERZEICHEN auf zu &amp;quot;zählen&amp;quot; on Sun, 02 Sep 2007 11:43:58 GMT]]></title><description><![CDATA[<p>Vielen Dank für, all die Hilfe, vorallem für die schnelle! Hilfe.<br />
Habs umgesetzt (hoffe ich :D) und nun funzts auch wie gewünscht XD</p>
<p>Danke<br />
Die Eule</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357231</guid><dc:creator><![CDATA[Die Eule]]></dc:creator><pubDate>Sun, 02 Sep 2007 11:43:58 GMT</pubDate></item></channel></rss>