<?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[CreateFile liefert einen ungültigen Handle]]></title><description><![CDATA[<p>Hallo brauch dringend Hilfe wenn ich eine Datei mit CreateFile erzeugen will schlägt das immer fehl. Mit getlasterror erhalte ich immer eine 6. Woran liegt das bin schon am verzweifeln deshalb wende ich mich jetzt an Euch.</p>
<p>Bitte helft mir</p>
<p>danke schon mal</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/55011/createfile-liefert-einen-ungültigen-handle</link><generator>RSS for Node</generator><lastBuildDate>Mon, 01 Jun 2026 22:11:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/55011.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Nov 2003 18:21:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 18:21:37 GMT]]></title><description><![CDATA[<p>Hallo brauch dringend Hilfe wenn ich eine Datei mit CreateFile erzeugen will schlägt das immer fehl. Mit getlasterror erhalte ich immer eine 6. Woran liegt das bin schon am verzweifeln deshalb wende ich mich jetzt an Euch.</p>
<p>Bitte helft mir</p>
<p>danke schon mal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392692</guid><dc:creator><![CDATA[Jarin]]></dc:creator><pubDate>Wed, 12 Nov 2003 18:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 19:36:29 GMT]]></title><description><![CDATA[<p>Bist du sicher, dass du zwischen CreateFile und GetLastError nicht noch versuchst, irgendwas mit dem Handle zu tun?</p>
<p>Zeig mal den Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392747</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392747</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 12 Nov 2003 19:36:29 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 19:48:02 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">CreateFile(&quot;C:\\Test\\test.txt&quot;, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
int err = GetLastError();
</code></pre>
<p>danke das Du mir hilfst <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/392753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392753</guid><dc:creator><![CDATA[Jarin]]></dc:creator><pubDate>Wed, 12 Nov 2003 19:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 20:03:45 GMT]]></title><description><![CDATA[<p>Kann das ein alter fehlercode sein? Verwende mal</p>
<pre><code>SetLastError(0);
CreateFile(&quot;C:\\Test\\test.txt&quot;, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); 
int err = GetLastError();
</code></pre>
<p>Was gibt denn CreateFile zurück? INVALID_HANDLE_VALUE ( == (HANDLE)(void *)-1 )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392762</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Wed, 12 Nov 2003 20:03:45 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 20:34:49 GMT]]></title><description><![CDATA[<p>ja INVALID_HANDLE_VALUE bekomme ich zurück (6)</p>
<p>Weis nicht ob der alt ist was macht den setlasterror genau ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392791</guid><dc:creator><![CDATA[Jarin]]></dc:creator><pubDate>Wed, 12 Nov 2003 20:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 20:40:03 GMT]]></title><description><![CDATA[<p>Es gibt einen Unterschied zwischen ERROR_INVALID_HANDLE (6) und INVALID_HANDLE_VALUE. Es geht um den Rückgabewert von CreateFile, nicht von GetLastError. GetLastError darfst du nur aufrufen, wenn etwas nicht geklappt hat. Ob CreateFile geklappt hat, erkennst du an dessen Rückgabewert, den dein Code aber gar nicht verwendet. Das ist umso schlimmer, als du ohne diesen Wert ohnehin nicht viel mit der Datei machen kannst.</p>
<p>Also:</p>
<p>HANDLE hWasWeissIch = CreateFile(...<br />
if(INVALID_HANDLE_VALUE == hWasWeissIch) // jetzt erst ist ein Fehler aufgetreten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392797</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392797</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 12 Nov 2003 20:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 20:53:59 GMT]]></title><description><![CDATA[<p>Als Handle bekomme ich einen 00000x zurück habe ich im debugger gesehen daran habe ich es auch erkannt. Aber stimmt schon das getlasterror nicht hier sinn macht. Was kann ich noch probieren ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392814</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392814</guid><dc:creator><![CDATA[Jarin]]></dc:creator><pubDate>Wed, 12 Nov 2003 20:53:59 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 21:30:04 GMT]]></title><description><![CDATA[<p>SetLastError(0) löscht den letzten error code.</p>
<p>0 ist per definition ein gültiger Wert für ein Handle - sollte aber eigentlich nicht auftreten.</p>
<p>Hm. Bin ich überfragt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/392854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392854</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Wed, 12 Nov 2003 21:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile liefert einen ungültigen Handle on Wed, 12 Nov 2003 21:33:17 GMT]]></title><description><![CDATA[<p>ich probier das mal morgen ind er Firma danke dir für deine Hilfe <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/392858</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/392858</guid><dc:creator><![CDATA[Jarin]]></dc:creator><pubDate>Wed, 12 Nov 2003 21:33:17 GMT</pubDate></item></channel></rss>