<?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[denkfehler in suchfunktion?]]></title><description><![CDATA[<p>ich wollte mal ne suchfunktion schreibseln die nen char in nem char sucht:</p>
<pre><code class="language-cpp">int SearchChar(char *lpStrContent, char *lpStrString)
{
	for(int i=0;i&lt;strlen(lpStrContent);++i)
	{
		for(int x=0;x&lt;strlen(lpStrString);++x)
		{
			if(lpStrContent[i+x] != lpStrString[x])
			{
				x=strlen(lpStrString);
			}
			else if(x==strlen(lpStrString))
			{
				return i;
			}
		}
	}
	return -1;
}
</code></pre>
<p>kriege immer -1 zurück...wo liegt der denkfehler? ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/78002/denkfehler-in-suchfunktion</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 00:55:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/78002.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jun 2004 22:48:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to denkfehler in suchfunktion? on Sat, 26 Jun 2004 22:48:27 GMT]]></title><description><![CDATA[<p>ich wollte mal ne suchfunktion schreibseln die nen char in nem char sucht:</p>
<pre><code class="language-cpp">int SearchChar(char *lpStrContent, char *lpStrString)
{
	for(int i=0;i&lt;strlen(lpStrContent);++i)
	{
		for(int x=0;x&lt;strlen(lpStrString);++x)
		{
			if(lpStrContent[i+x] != lpStrString[x])
			{
				x=strlen(lpStrString);
			}
			else if(x==strlen(lpStrString))
			{
				return i;
			}
		}
	}
	return -1;
}
</code></pre>
<p>kriege immer -1 zurück...wo liegt der denkfehler? ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/548667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/548667</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Sat, 26 Jun 2004 22:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to denkfehler in suchfunktion? on Sat, 26 Jun 2004 23:03:59 GMT]]></title><description><![CDATA[<p>habs:</p>
<pre><code class="language-cpp">int SearchChar(char *lpStrContent, char *lpStrString)
{
	for(int i=0;i&lt;strlen(lpStrContent);++i)
	{
		for(int x=0;x&lt;strlen(lpStrString);++x)
		{
			if(lpStrContent[i+x] != lpStrString[x])
			{
				x=strlen(lpStrString);
			}
			else if(x==strlen(lpStrString)-1)
			{
				return i;
			}
		}
	}
	return -1;
}
</code></pre>
<p>aber jetzt noch ne frage direkt dazu: ich hab n window welches als edit feld dient. Nun will ich den gefunden text markieren:</p>
<pre><code class="language-cpp">SendMessage(textField,EM_SETSEL, SearchChar(WindowText(textField), searchcharx), SearchChar(WindowText(textField), searchcharx)+strlen(searchcharx));
</code></pre>
<p>nix passiert!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/548669</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/548669</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Sat, 26 Jun 2004 23:03:59 GMT</pubDate></item></channel></rss>