<?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[HANDLE&#x2F;CFile Problem]]></title><description><![CDATA[<p>Hi</p>
<pre><code class="language-cpp">{
	// TODO: Add your control notification handler code here
	HANDLE hFile=CreateFile(_T(&quot;profile\test.txt&quot;),
         FILE_ALL_ACCESS, FILE_SHARE_WRITE,
         NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
	AfxMessageBox(_T(&quot;konnts ned öffnen&quot;));
	CFile profile(hFile);
char lala[]=&quot;erste benutzung der write funktion&quot;;
profile.Write(lala, lstrlen(lala));
}
</code></pre>
<p>Beim kompillieren entsteht folgender Fehler:<br />
cannot conver Paramter 1 drom void* to int</p>
<p>ich hab den code aber relativ gleich aus der MSDN übernommen, was mach ich fals? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <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="😃"
    /></p>
<p>mfg<br />
thenoob</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/80726/handle-cfile-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 21:15:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/80726.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 23 Jul 2004 21:16:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HANDLE&#x2F;CFile Problem on Fri, 23 Jul 2004 21:16:38 GMT]]></title><description><![CDATA[<p>Hi</p>
<pre><code class="language-cpp">{
	// TODO: Add your control notification handler code here
	HANDLE hFile=CreateFile(_T(&quot;profile\test.txt&quot;),
         FILE_ALL_ACCESS, FILE_SHARE_WRITE,
         NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
	AfxMessageBox(_T(&quot;konnts ned öffnen&quot;));
	CFile profile(hFile);
char lala[]=&quot;erste benutzung der write funktion&quot;;
profile.Write(lala, lstrlen(lala));
}
</code></pre>
<p>Beim kompillieren entsteht folgender Fehler:<br />
cannot conver Paramter 1 drom void* to int</p>
<p>ich hab den code aber relativ gleich aus der MSDN übernommen, was mach ich fals? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <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="😃"
    /></p>
<p>mfg<br />
thenoob</p>
]]></description><link>https://www.c-plusplus.net/forum/post/567185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/567185</guid><dc:creator><![CDATA[thenoob]]></dc:creator><pubDate>Fri, 23 Jul 2004 21:16:38 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE&#x2F;CFile Problem on Fri, 23 Jul 2004 22:47:48 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>du benötigst einen cast, außerdem ist ein Fehler in der Schreibweise der Datei (Escape-Sequenz beachten!), und noch außerdem solltest du nach der Messagebox nicht trotzdem ein CFile-Objekt erstellen:</p>
<pre><code class="language-cpp">{
    // TODO: Add your control notification handler code here
    HANDLE hFile=CreateFile(_T(&quot;profile\\test.txt&quot;),
         FILE_ALL_ACCESS, FILE_SHARE_WRITE,
         NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (hFile == INVALID_HANDLE_VALUE)
        AfxMessageBox(_T(&quot;konnts ned öffnen&quot;));
    else
    {
        CFile profile(reinterpret_cast&lt;int&gt;(hFile));
        char lala[]=&quot;erste benutzung der write funktion&quot;;
        profile.Write(lala, lstrlen(lala));
    }
}
</code></pre>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/567205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/567205</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Fri, 23 Jul 2004 22:47:48 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE&#x2F;CFile Problem on Fri, 23 Jul 2004 23:54:08 GMT]]></title><description><![CDATA[<p>ok vielen Dank<br />
aber was genau is dieser Cast?<br />
und wieso brauch ich den?</p>
<p>mfg<br />
thenoob</p>
]]></description><link>https://www.c-plusplus.net/forum/post/567217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/567217</guid><dc:creator><![CDATA[thenoob]]></dc:creator><pubDate>Fri, 23 Jul 2004 23:54:08 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE&#x2F;CFile Problem on Sat, 24 Jul 2004 08:18:25 GMT]]></title><description><![CDATA[<p>der Konstruktor von CFile:</p>
<p><strong>CFile( int hFile );</strong></p>
<p>erwartet einen int, aber hFile ist ein &quot;verkappter&quot; void-Zeiger(void*), ein HANDLE:</p>
<p><strong>HANDLE hFile</strong>=CreateFile(_T(&quot;profile\\test.txt&quot;),<br />
FILE_ALL_ACCESS, FILE_SHARE_WRITE,<br />
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);</p>
<p>C++ ist eine typsichere Sprache, und achtet genau darauf, ob die Typen &quot;kompatibel&quot; sind, wenn nicht, meckert der Compiler, also hier:</p>
<p><strong>CFile profile(hFile);</strong></p>
<p>Hier haben wir einen deutlichen Fall: ein Zeiger soll als int-Parameter behandelt werden, und deswegen muß man dies über einen cast explizit anfordern:</p>
<p>CFile profile(<strong>reinterpret_cast&lt;int&gt;</strong>(hFile));</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/567249</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/567249</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Sat, 24 Jul 2004 08:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to HANDLE&#x2F;CFile Problem on Sat, 24 Jul 2004 14:45:19 GMT]]></title><description><![CDATA[<p>Wenn du schon CFile verwendest kannst du es auch gleich zum öffnen/neuesfile verwenden.</p>
<pre><code class="language-cpp">CFile fFile;
CFileException *feError = NULL;

m_fFile.Open(szFile, CFile::modeCreate | CFile::modeReadWrite | CFile::shareDenyWrite ,feError))
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/567442</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/567442</guid><dc:creator><![CDATA[Unix-Tom]]></dc:creator><pubDate>Sat, 24 Jul 2004 14:45:19 GMT</pubDate></item></channel></rss>