<?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[Unicode Version für fstream? (wfstream?)]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich stelle gerade meinen Source auf Unicode um. Ich möchte eine Datei öffnen:</p>
<pre><code class="language-cpp">wfstream oFile;
oFile.open(m_wStr.c_str(), ios::out + ios::binary + ios::trunc);
if (oFile) {
...
</code></pre>
<p>Jetzt bekomme ich bei der Zeile wo die Datei geöffnet wird diesen Fehler:</p>
<pre><code>'void __thiscall std::basic_fstream&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt; &gt;::open(const char *,int)' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
</code></pre>
<p>Warum erwartet er als ersten Parameter noch immer einen char* und keinen wchar_t? Ich benutze doch die wfstream? In meinem Buch steht das sei die Unicode Version. (Ich könnte die fstream verwenden, weil ich binär öffne, dann müsste ich aber den Pfad in std::string oder char* angeben)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/178595/unicode-version-für-fstream-wfstream</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 23:57:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/178595.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Apr 2007 13:38:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 13:38:00 GMT]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich stelle gerade meinen Source auf Unicode um. Ich möchte eine Datei öffnen:</p>
<pre><code class="language-cpp">wfstream oFile;
oFile.open(m_wStr.c_str(), ios::out + ios::binary + ios::trunc);
if (oFile) {
...
</code></pre>
<p>Jetzt bekomme ich bei der Zeile wo die Datei geöffnet wird diesen Fehler:</p>
<pre><code>'void __thiscall std::basic_fstream&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt; &gt;::open(const char *,int)' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
</code></pre>
<p>Warum erwartet er als ersten Parameter noch immer einen char* und keinen wchar_t? Ich benutze doch die wfstream? In meinem Buch steht das sei die Unicode Version. (Ich könnte die fstream verwenden, weil ich binär öffne, dann müsste ich aber den Pfad in std::string oder char* angeben)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264683</guid><dc:creator><![CDATA[WinApi Neuling]]></dc:creator><pubDate>Thu, 12 Apr 2007 13:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 15:49:42 GMT]]></title><description><![CDATA[<blockquote>
<p>This is by design. There is no way in standard C nor standard C++ to<br />
refer to a file with Unicode name.<br />
...<br />
Their rationale was as Igor said: Some (most) file systems cannot handle<br />
unicode filenames.</p>
</blockquote>
<p><a href="http://groups.google.de/group/microsoft.public.vc.stl/browse_thread/thread/66b84edc6e393146/5f454acb5f7b1bf6?q=c%2B%2B+wfstream&amp;lnk=ol&amp;hl=de&amp;" rel="nofollow">http://groups.google.de/group/microsoft.public.vc.stl/browse_thread/thread/66b84edc6e393146/5f454acb5f7b1bf6?q=c%2B%2B+wfstream&amp;lnk=ol&amp;hl=de&amp;</a><br />
Hätte man trotzdem anbieten können. Der Programmierer hätte dann schon gewußt das sein OS kein Unicode im Pfad unterstützt.</p>
<p>Manchmal frage ich mich ob dieses C++ auch wirklich eingesetzt wird. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1264789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264789</guid><dc:creator><![CDATA[WinApi Neuling]]></dc:creator><pubDate>Thu, 12 Apr 2007 15:49:42 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 15:52:41 GMT]]></title><description><![CDATA[<p>Kommt anscheinend darauf an, welche Std-Lib-Implementierung du hast.<br />
Aber der Datenstrom dürfte bei dir trotzdem breit sein. Also die Ein-/Ausgabe-Operatoren sind bestimmt breit! Nur halt der Dateiname anscheinend nicht, der ist ASCII.</p>
<p>In der VC++2005 ist z.B. beides verfügbar:<br />
<a href="http://msdn2.microsoft.com/en-us/library/4dx08bh4(VS.80).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/4dx08bh4(VS.80).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264791</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Thu, 12 Apr 2007 15:52:41 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 15:59:32 GMT]]></title><description><![CDATA[<p>WinApi Neuling schrieb:</p>
<blockquote>
<p>Manchmal frage ich mich ob dieses C++ auch wirklich eingesetzt wird. <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>
</blockquote>
<p>Die meisten setzen bisher sicherlich native File-Funktionen ein, wenn sie Unicode-Filenames haben wollen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264795</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Thu, 12 Apr 2007 15:59:32 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 15:59:46 GMT]]></title><description><![CDATA[<p>Gibt es vielleicht ein anderes C++ Objekt mit dem ich Dateien schreiben kann? (Mit Unicode Pfadangabe)</p>
<p>Mit GetTempPathW() bekomme ich den Unicode Pfad. Den Krampf mit der wchar_t -&gt; char Umwandlung wollte ich mir nicht antun.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264796</guid><dc:creator><![CDATA[WinApi Neuling]]></dc:creator><pubDate>Thu, 12 Apr 2007 15:59:46 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 16:02:26 GMT]]></title><description><![CDATA[<p>Wenn du sowieso schon die WinAPI (lt. Name) verwendest kannst du ja mit CreateFile() und WriteFile() arbeiten.</p>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264800</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264800</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Thu, 12 Apr 2007 16:02:26 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 16:02:34 GMT]]></title><description><![CDATA[<p>Stichwort: UTF8</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1264801</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264801</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Thu, 12 Apr 2007 16:02:34 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Version für fstream? (wfstream?) on Thu, 12 Apr 2007 16:43:19 GMT]]></title><description><![CDATA[<p>Ich habe es mit der WinApi gemacht.</p>
<p>Vielen Dank Euch allen <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/1264827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1264827</guid><dc:creator><![CDATA[WinApi Neuling]]></dc:creator><pubDate>Thu, 12 Apr 2007 16:43:19 GMT</pubDate></item></channel></rss>