<?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[Absturz beim Einlesen  aus einem wifstream]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem beim Einlesen einer UTF-8-kodierten Datei. Hier der destillierte Code:</p>
<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
   wifstream f;
   f.open (&quot;funnychars.ini&quot;, wifstream::in);
   wstring wstr;   
   while(getline(f, wstr)) 
       wcout &lt;&lt; wstr &lt;&lt; endl;  
   f.close();
  return 0;
}
</code></pre>
<p>Bei dem oberen Code geht er nie in die Schleife hinein, obwohl open funktioniert hat und die Datei nicht leer ist.</p>
<p>Wenn ich es alternativ so wie folgt loesen wollte, bekomme ich einen SIGABRT. Ich verwende gcc unter Linux (Ubuntu).</p>
<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
   wifstream f;
   f.open (&quot;funnychars.ini&quot;, wifstream::in);
   wstring wstr;   
   wchar_t wc, dummy;
   while(f &gt;&gt; wc) {              //  &lt;--  beim 1. Leseversuch stuerzt er ab 
       f &gt;&gt; dummy;
       f &gt;&gt; wstr;
      wcout &lt;&lt; wstr &lt;&lt; endl;  
   } 
   f.close();
   return 0;
}
</code></pre>
<p>Die Datei funnychars.ini schaut so aus:</p>
<pre><code>Ä Adieresis
Ö Odieresis
Ü Udieresis
ä adieresis
ö odieresis
ü udieresis
ß germandbls
&lt;... etc... &gt;
</code></pre>
<p>Was mache ich falsch ?? Bitte um Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/210783/absturz-beim-einlesen-aus-einem-wifstream</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 17:31:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/210783.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Apr 2008 09:40:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Absturz beim Einlesen  aus einem wifstream on Tue, 15 Apr 2008 09:40:18 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem beim Einlesen einer UTF-8-kodierten Datei. Hier der destillierte Code:</p>
<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
   wifstream f;
   f.open (&quot;funnychars.ini&quot;, wifstream::in);
   wstring wstr;   
   while(getline(f, wstr)) 
       wcout &lt;&lt; wstr &lt;&lt; endl;  
   f.close();
  return 0;
}
</code></pre>
<p>Bei dem oberen Code geht er nie in die Schleife hinein, obwohl open funktioniert hat und die Datei nicht leer ist.</p>
<p>Wenn ich es alternativ so wie folgt loesen wollte, bekomme ich einen SIGABRT. Ich verwende gcc unter Linux (Ubuntu).</p>
<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std;

int main() {
   wifstream f;
   f.open (&quot;funnychars.ini&quot;, wifstream::in);
   wstring wstr;   
   wchar_t wc, dummy;
   while(f &gt;&gt; wc) {              //  &lt;--  beim 1. Leseversuch stuerzt er ab 
       f &gt;&gt; dummy;
       f &gt;&gt; wstr;
      wcout &lt;&lt; wstr &lt;&lt; endl;  
   } 
   f.close();
   return 0;
}
</code></pre>
<p>Die Datei funnychars.ini schaut so aus:</p>
<pre><code>Ä Adieresis
Ö Odieresis
Ü Udieresis
ä adieresis
ö odieresis
ü udieresis
ß germandbls
&lt;... etc... &gt;
</code></pre>
<p>Was mache ich falsch ?? Bitte um Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1492285</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1492285</guid><dc:creator><![CDATA[Diogenes77]]></dc:creator><pubDate>Tue, 15 Apr 2008 09:40:18 GMT</pubDate></item></channel></rss>