<?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[Eigene Struct zu LPVOID]]></title><description><![CDATA[<p>Hallo Forum,<br />
ich bin grade bei Winsockets. Ich habe eine eigene kleine Struktur CONNECTION. Da ich mehrere Clients haben will, benutze ich Threads:</p>
<pre><code class="language-cpp">CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE) Listen_To_Connection, (LPVOID) connection, NULL, 0);
</code></pre>
<p>Das geht aber leider nicht, da man mein CONNECTION nicht zu LPVOID casten kann. Versucht habe ich es mit einem Zeiger auf CONNECTION, auf void, ich habe einen reinterpret_cast benutzt, aber nichts klappt.</p>
<p>Kann mir einer helfen?<br />
mit freundlichen Grüßen TheCrip</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270297/eigene-struct-zu-lpvoid</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 11:06:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270297.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Jul 2010 18:51:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 18:51:42 GMT]]></title><description><![CDATA[<p>Hallo Forum,<br />
ich bin grade bei Winsockets. Ich habe eine eigene kleine Struktur CONNECTION. Da ich mehrere Clients haben will, benutze ich Threads:</p>
<pre><code class="language-cpp">CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE) Listen_To_Connection, (LPVOID) connection, NULL, 0);
</code></pre>
<p>Das geht aber leider nicht, da man mein CONNECTION nicht zu LPVOID casten kann. Versucht habe ich es mit einem Zeiger auf CONNECTION, auf void, ich habe einen reinterpret_cast benutzt, aber nichts klappt.</p>
<p>Kann mir einer helfen?<br />
mit freundlichen Grüßen TheCrip</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924041</guid><dc:creator><![CDATA[TheCrip]]></dc:creator><pubDate>Fri, 09 Jul 2010 18:51:42 GMT</pubDate></item><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 18:56:51 GMT]]></title><description><![CDATA[<p>Probier mal <code>(LPVOID) &amp;connection</code> . Da musste in der Funktion dann natürlich entsprechend dereferenzieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924043</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924043</guid><dc:creator><![CDATA[ipsec]]></dc:creator><pubDate>Fri, 09 Jul 2010 18:56:51 GMT</pubDate></item><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 19:04:34 GMT]]></title><description><![CDATA[<p>So hab ich es probiert:</p>
<pre><code class="language-cpp">//in der main
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE) Listen_To_Connection, (LPVOID) &amp;(connection[nCount]) , NULL, 0);

//Später...

int WINAPI Listen_To_Connection(LPVOID data)
{
	CONNECTION c;
	&amp;c = data; // Auch mit verschiedenen casts
//...
}
</code></pre>
<p>Das klappt leider nicht: error C2440: '=': 'LPVOID' kann nicht in 'CONNECTION *' konvertiert werden<br />
Auch wenn ich einen Zeiger *c nehme, wird das nix.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924045</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924045</guid><dc:creator><![CDATA[TheCrip]]></dc:creator><pubDate>Fri, 09 Jul 2010 19:04:34 GMT</pubDate></item><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 19:08:25 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int WINAPI Listen_To_Connection(LPVOID data)
{
    CONNECTION *c = data;  // habs nich getestet, eventuell ist static_cast oder reinterpret_cast nötig
    c-&gt;foo();

    // alternativ:

    CONNECTION &amp;c = *data; // evntl. mit cast
    c.foo();
}
</code></pre>
<p>Sowas gehört aber mehr oder weniger zu den Basics.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924048</guid><dc:creator><![CDATA[ipsec]]></dc:creator><pubDate>Fri, 09 Jul 2010 19:08:25 GMT</pubDate></item><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 19:10:58 GMT]]></title><description><![CDATA[<p>ipsec schrieb:</p>
<blockquote>
<p>Sowas gehört aber mehr oder weniger zu den Basics.</p>
</blockquote>
<p>Jup, erst laufen lernen, dann Rennen fahren. <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/1924050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924050</guid><dc:creator><![CDATA[Nukularfüsiker]]></dc:creator><pubDate>Fri, 09 Jul 2010 19:10:58 GMT</pubDate></item><item><title><![CDATA[Reply to Eigene Struct zu LPVOID on Fri, 09 Jul 2010 19:18:54 GMT]]></title><description><![CDATA[<p>Nur ersteres klappt, mit einem reinterpret_cast. Ich hab das reinterpreten aber nur beim Aufruf von CreateThread benutzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>E: Bei mir ist es mittlerweile Learning bei Doing...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1924053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1924053</guid><dc:creator><![CDATA[TheCrip]]></dc:creator><pubDate>Fri, 09 Jul 2010 19:18:54 GMT</pubDate></item></channel></rss>