<?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[Problem mit _beginthread in einer Schleife]]></title><description><![CDATA[<p>Morgen</p>
<p>habe folgendes Problem:</p>
<p>Ich hab einen while-Schleife und in der ruf ich _beginthread() auf, mit einer Variablen in der ein Pfad steht, wenn ich die Schleife durchlaufe, wird arbeitet der Thread aber immer nur mit der letzten Pfadangabe, woran liegt das?</p>
<p>Hier noch der Code:</p>
<pre><code class="language-cpp">int main(int argc, char* argv[])
{
	int a;

	FILE * ini;
	char str1[100];
	CString str;

	ini = fopen(&quot;C:\\dir.ini&quot;, &quot;r&quot;);

	int counter = 0;

	while (!feof(ini))
	{
		fscanf(ini, &quot;%s\n&quot;, str1);
		printf(&quot;%s\n&quot;, str1);
		if (str1[0] != '[')
		{

			str = str1;
			str.Delete(0, 5);

			_beginthread( Thread_Watch, 0, (void*)(LPCTSTR)str);
			_beginthread( Thread_Acc, 0, (void*)(LPCTSTR)str);
			counter++;	
			//AfxMessageBox(str);
		}
	}

	printf(&quot;%d\n&quot;, counter);

	cin &gt;&gt; a;
	fclose(ini);
	////////////////////////////////////////////////////////////
	return 0;
}
</code></pre>
<p>Lg Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/77866/problem-mit-_beginthread-in-einer-schleife</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 23:13:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/77866.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Jun 2004 09:16:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit _beginthread in einer Schleife on Fri, 25 Jun 2004 09:16:27 GMT]]></title><description><![CDATA[<p>Morgen</p>
<p>habe folgendes Problem:</p>
<p>Ich hab einen while-Schleife und in der ruf ich _beginthread() auf, mit einer Variablen in der ein Pfad steht, wenn ich die Schleife durchlaufe, wird arbeitet der Thread aber immer nur mit der letzten Pfadangabe, woran liegt das?</p>
<p>Hier noch der Code:</p>
<pre><code class="language-cpp">int main(int argc, char* argv[])
{
	int a;

	FILE * ini;
	char str1[100];
	CString str;

	ini = fopen(&quot;C:\\dir.ini&quot;, &quot;r&quot;);

	int counter = 0;

	while (!feof(ini))
	{
		fscanf(ini, &quot;%s\n&quot;, str1);
		printf(&quot;%s\n&quot;, str1);
		if (str1[0] != '[')
		{

			str = str1;
			str.Delete(0, 5);

			_beginthread( Thread_Watch, 0, (void*)(LPCTSTR)str);
			_beginthread( Thread_Acc, 0, (void*)(LPCTSTR)str);
			counter++;	
			//AfxMessageBox(str);
		}
	}

	printf(&quot;%d\n&quot;, counter);

	cin &gt;&gt; a;
	fclose(ini);
	////////////////////////////////////////////////////////////
	return 0;
}
</code></pre>
<p>Lg Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/547664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/547664</guid><dc:creator><![CDATA[housefreak]]></dc:creator><pubDate>Fri, 25 Jun 2004 09:16:27 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit _beginthread in einer Schleife on Fri, 25 Jun 2004 10:18:55 GMT]]></title><description><![CDATA[<p>Von str existiert bei dir 1 object, d.h. der string liegt 1 mal im speicher.<br />
Du gibts nun nen zeiger auf diesen string an alle deine threads, d.h. sie greifen alle auf den SELBEN speicher zu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/547721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/547721</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Fri, 25 Jun 2004 10:18:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit _beginthread in einer Schleife on Fri, 25 Jun 2004 12:19:08 GMT]]></title><description><![CDATA[<p>Danke jetzt läufts!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/547846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/547846</guid><dc:creator><![CDATA[housefreak]]></dc:creator><pubDate>Fri, 25 Jun 2004 12:19:08 GMT</pubDate></item></channel></rss>