<?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[[c++] File Stream problem]]></title><description><![CDATA[<p>moin, ich habe wieder ne frage :</p>
<p>ich öffne ne datei und schreibe den gelichen inhalt + neuen dazu:</p>
<pre><code>win_file wurde oben definiert asl string (string win_file;)
.....

    ifstream ein(&quot;test.txt&quot;);
    while (!ein.eof())
    {
        char eingang;
        eingang = ein.get();
        win_file = win_file + eingang;
    }
    ein.close();

    ofstream aus(&quot;test.txt&quot;);
    aus&lt;&lt;win_file&lt;&lt;endl;
    aus&lt;&lt;&quot;HAllo neuer inhalt&quot;&lt;&lt;endl;
    aus.close();

.....
</code></pre>
<p>die test.txt sah vor dem ausführen so aus:</p>
<pre><code>hallo alter inahlt
</code></pre>
<p>danach so :</p>
<pre><code>hallo alter inhalt
ÿ
HAllo neuer inhalt
</code></pre>
<p>woher kommt das ÿ?<br />
soweit ich weis steht das ÿ für binary = 0, aber wie kriege ich es weg, der liest das von irgend wo ein!</p>
<p>pls help</p>
<p>mfg psihxxx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/131625/c-file-stream-problem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 05:02:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/131625.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Jan 2006 20:11:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [c++] File Stream problem on Wed, 04 Jan 2006 20:11:29 GMT]]></title><description><![CDATA[<p>moin, ich habe wieder ne frage :</p>
<p>ich öffne ne datei und schreibe den gelichen inhalt + neuen dazu:</p>
<pre><code>win_file wurde oben definiert asl string (string win_file;)
.....

    ifstream ein(&quot;test.txt&quot;);
    while (!ein.eof())
    {
        char eingang;
        eingang = ein.get();
        win_file = win_file + eingang;
    }
    ein.close();

    ofstream aus(&quot;test.txt&quot;);
    aus&lt;&lt;win_file&lt;&lt;endl;
    aus&lt;&lt;&quot;HAllo neuer inhalt&quot;&lt;&lt;endl;
    aus.close();

.....
</code></pre>
<p>die test.txt sah vor dem ausführen so aus:</p>
<pre><code>hallo alter inahlt
</code></pre>
<p>danach so :</p>
<pre><code>hallo alter inhalt
ÿ
HAllo neuer inhalt
</code></pre>
<p>woher kommt das ÿ?<br />
soweit ich weis steht das ÿ für binary = 0, aber wie kriege ich es weg, der liest das von irgend wo ein!</p>
<p>pls help</p>
<p>mfg psihxxx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/957083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/957083</guid><dc:creator><![CDATA[psihxxx]]></dc:creator><pubDate>Wed, 04 Jan 2006 20:11:29 GMT</pubDate></item><item><title><![CDATA[Reply to [c++] File Stream problem on Wed, 04 Jan 2006 20:27:01 GMT]]></title><description><![CDATA[<p>1. benutze cpp-tags um syntaks-heileiting zu bekommen<br />
2. das y-ü kommt daher, dass das ende der datei erreicht wurde,<br />
du aber trotzdem das zeichen schreibst.</p>
<pre><code class="language-cpp">ifstream ein(&quot;test.txt&quot;);
    while (!ein.eof())
    {
        char eingang;
        eingang = ein.get();
           // &lt;= du musst hier prüfen, ob eof()
        win_file = win_file + eingang;
           // &lt;= nicht hier 
    }
    ein.close();

    ofstream aus(&quot;test.txt&quot;);
    aus&lt;&lt;win_file&lt;&lt;endl;
    aus&lt;&lt;&quot;HAllo neuer inhalt&quot;&lt;&lt;endl;
    aus.close();

.....
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/957104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/957104</guid><dc:creator><![CDATA[ölks]]></dc:creator><pubDate>Wed, 04 Jan 2006 20:27:01 GMT</pubDate></item><item><title><![CDATA[Reply to [c++] File Stream problem on Wed, 04 Jan 2006 22:05:01 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">while (true)
    {
        char eingang;
        eingang = ein.get();
        if(ein.eof())
        {
            break;
        }
        win_file = win_file + eingang;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/957234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/957234</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Wed, 04 Jan 2006 22:05:01 GMT</pubDate></item><item><title><![CDATA[Reply to [c++] File Stream problem on Wed, 04 Jan 2006 23:15:48 GMT]]></title><description><![CDATA[<p>jo danke! wieso bin ich nicht drauf gekommen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/957287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/957287</guid><dc:creator><![CDATA[psihxxx]]></dc:creator><pubDate>Wed, 04 Jan 2006 23:15:48 GMT</pubDate></item><item><title><![CDATA[Reply to [c++] File Stream problem on Thu, 05 Jan 2006 10:05:55 GMT]]></title><description><![CDATA[<p>Einfacher wäre:</p>
<pre><code>{
  ifstream ein(&quot;test.txt&quot;);
  copy(istream_iterator&lt;char&gt;(ein),
       istream_iteartor&lt;char&gt;(),
       back_inserter(win_file));
}
</code></pre>
<p>Da kann Dir sowas nicht mehr passieren.</p>
<p>Die geschweiften Klammern sind übrigens absicht. Das definiert einen Gültigkeitsbereich, so daß die Datei an der schliessenden Klammer automatisch geschlossen wird.</p>
<p>Tommi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/957519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/957519</guid><dc:creator><![CDATA[tntnet]]></dc:creator><pubDate>Thu, 05 Jan 2006 10:05:55 GMT</pubDate></item></channel></rss>