<?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[Für was brauche ich &amp;quot;.eof()&amp;quot;]]></title><description><![CDATA[<p>Wenn ich doch z.B.:</p>
<pre><code class="language-cpp">ifstream file(&quot;H:/text.txt&quot;);
</code></pre>
<p>habe, dann kann ich doch einfach</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{
    ifstream file(&quot;H:/text.txt&quot;);
    while(file)
    {
        string buffer;
        getline(file,buffer);
        cout &lt;&lt; buffer &lt;&lt; &quot;\n&quot;;
    }

	return 0;
}
</code></pre>
<p>machen, und benötige das &quot;.eof()&quot; gar nicht? Für was brauch ich des den dann eigentlich?<br />
MfG<br />
Stromberg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/203790/für-was-brauche-ich-quot-eof-quot</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 19:03:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/203790.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jan 2008 15:22:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 15:22:20 GMT]]></title><description><![CDATA[<p>Wenn ich doch z.B.:</p>
<pre><code class="language-cpp">ifstream file(&quot;H:/text.txt&quot;);
</code></pre>
<p>habe, dann kann ich doch einfach</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{
    ifstream file(&quot;H:/text.txt&quot;);
    while(file)
    {
        string buffer;
        getline(file,buffer);
        cout &lt;&lt; buffer &lt;&lt; &quot;\n&quot;;
    }

	return 0;
}
</code></pre>
<p>machen, und benötige das &quot;.eof()&quot; gar nicht? Für was brauch ich des den dann eigentlich?<br />
MfG<br />
Stromberg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444033</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444033</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Sat, 26 Jan 2008 15:22:20 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 15:27:30 GMT]]></title><description><![CDATA[<p>damit du das dateiende von fehlern, die beim lesen aufgetreten sind, unterscheiden kannst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444036</guid><dc:creator><![CDATA[ghorst]]></dc:creator><pubDate>Sat, 26 Jan 2008 15:27:30 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 15:30:55 GMT]]></title><description><![CDATA[<p>ifstream ist eine Klasse und keine Funktion mit einem Rückgabewert.</p>
<p><a href="http://www.cplusplus.com/reference/iostream/ifstream/" rel="nofollow">http://www.cplusplus.com/reference/iostream/ifstream/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444039</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444039</guid><dc:creator><![CDATA[__stefan_]]></dc:creator><pubDate>Sat, 26 Jan 2008 15:30:55 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 15:32:46 GMT]]></title><description><![CDATA[<p><a href="http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=eof#Answ" rel="nofollow">http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=eof#Answ</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444040</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444040</guid><dc:creator><![CDATA[fara]]></dc:creator><pubDate>Sat, 26 Jan 2008 15:32:46 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 15:47:39 GMT]]></title><description><![CDATA[<p>Ich check aber jetzt net so ganz, was der große Unterschied zwischen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{
    ifstream file(&quot;H:/text.txt&quot;);
    while(!file.eof())
    {
        string buffer;
        getline(file,buffer);
        cout &lt;&lt; buffer &lt;&lt; &quot;\n&quot;;
    }

	return 0;
}
</code></pre>
<p>und</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

int main()
{
    ifstream file(&quot;H:/text.txt&quot;);
    while(file)
    {
        string buffer;
        getline(file,buffer);
        cout &lt;&lt; buffer &lt;&lt; &quot;\n&quot;;
    }

    return 0;
}
</code></pre>
<p>ist? Bei der Klasse &quot;ifstream&quot; sind halt die &quot;boolschen Operatoren&quot; überladen oder, vll. wird ja dann auch &quot;.eof()&quot; genutzt?<br />
MfG<br />
Stromberg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444052</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Sat, 26 Jan 2008 15:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 16:35:27 GMT]]></title><description><![CDATA[<p>Hi Stromberg,</p>
<p>ja, das ist ein Unterschied:<br />
Im ersten Fall überprüfst du, ob das eof-bit gesetzt ist:<br />
<a href="http://www.cplusplus.com/reference/iostream/ios/eof.html" rel="nofollow">http://www.cplusplus.com/reference/iostream/ios/eof.html</a></p>
<p>Im zweiten Fall, ob das fail- oder bad-bit gesetzt ist:<br />
<a href="http://www.cplusplus.com/reference/iostream/ios/operator_voidpt.html" rel="nofollow">http://www.cplusplus.com/reference/iostream/ios/operator_voidpt.html</a></p>
<p><a href="http://www.cplusplus.com/reference/iostream/istream/getline.html" rel="nofollow">http://www.cplusplus.com/reference/iostream/istream/getline.html</a></p>
<blockquote>
<p>Notice that some eofbit cases will also set failbit.</p>
</blockquote>
<p>Deswegen wird das in deinem Fall evtl. keinen Unterschied machen.<br />
Wann beide bits gleichzeitig gesetzt werden, kann ich dir allerdings auch nicht<br />
sagen.</p>
<p>Gruß,<br />
CSpille</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444077</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 26 Jan 2008 16:35:27 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 17:04:04 GMT]]></title><description><![CDATA[<p>schreib am besten while(getline(file,buffer)) ist viel schönerer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1444097</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444097</guid><dc:creator><![CDATA[.........]]></dc:creator><pubDate>Sat, 26 Jan 2008 17:04:04 GMT</pubDate></item><item><title><![CDATA[Reply to Für was brauche ich &amp;quot;.eof()&amp;quot; on Sat, 26 Jan 2008 17:07:24 GMT]]></title><description><![CDATA[<p>okay <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/1444099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1444099</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Sat, 26 Jan 2008 17:07:24 GMT</pubDate></item></channel></rss>