<?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[ifstream]]></title><description><![CDATA[<p>Hallo allerseits!<br />
ich verstehe folgendes nicht:</p>
<pre><code class="language-cpp">ifstream dictionary (s.c_str()); 
 if (!dictionary) // were there any errors on opening?
</code></pre>
<p>nun lese ich in der Hilfe folgendes:</p>
<p>A type basic_ifstream specialized on char template parameters.<br />
typedef basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; ifstream;</p>
<p>Was ich hier nicht sehe ist ein Rückgabewert, auf den die if(!dictionary)<br />
testet.<br />
Wie ist ifstream nun zu verstehen?<br />
Danke<br />
To</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126706/ifstream</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 19:56:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126706.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Nov 2005 06:30:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 06:30:33 GMT]]></title><description><![CDATA[<p>Hallo allerseits!<br />
ich verstehe folgendes nicht:</p>
<pre><code class="language-cpp">ifstream dictionary (s.c_str()); 
 if (!dictionary) // were there any errors on opening?
</code></pre>
<p>nun lese ich in der Hilfe folgendes:</p>
<p>A type basic_ifstream specialized on char template parameters.<br />
typedef basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; ifstream;</p>
<p>Was ich hier nicht sehe ist ein Rückgabewert, auf den die if(!dictionary)<br />
testet.<br />
Wie ist ifstream nun zu verstehen?<br />
Danke<br />
To</p>
]]></description><link>https://www.c-plusplus.net/forum/post/920144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920144</guid><dc:creator><![CDATA[Theresa_Orl]]></dc:creator><pubDate>Fri, 18 Nov 2005 06:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 06:43:33 GMT]]></title><description><![CDATA[<blockquote>
<p>operator !()<br />
Returns whether the stream has run into an error (corresponds to fail())</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/920149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920149</guid><dc:creator><![CDATA[Redhead]]></dc:creator><pubDate>Fri, 18 Nov 2005 06:43:33 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 06:49:31 GMT]]></title><description><![CDATA[<p>verstehe ich trotdem nicht.<br />
in:</p>
<pre><code class="language-cpp">ifstream dictionary (s.c_str());
</code></pre>
<p>wird versucht Argument von dictionary zu öffnen. Was hält dictinary nun?<br />
Nen Filepointer oder was?<br />
Und kann man mir erklären, wie diese Zeile hier zu verstehen ist:</p>
<pre><code class="language-cpp">typedef basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; ifstream;
</code></pre>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/920154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920154</guid><dc:creator><![CDATA[Theresa_Orl]]></dc:creator><pubDate>Fri, 18 Nov 2005 06:49:31 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 07:15:07 GMT]]></title><description><![CDATA[<p>Was ifstream hält ist doch egal... zumindest für dich als Benutzer(in) dieser Klasse. Ist ja auch der Sinn von Kapselung.</p>
<p>Dich wundert wohl eher das if-Konstrukt?!</p>
<p>Kennst du dich bereits mit Operator-Überladung aus? Wenn nicht, wirst du auch das if-Konstrukt nicht verstehen. Selbst wenn du jetzt wüsstest, was ifstream &quot;hält&quot;. (ist unwichtig!).</p>
<blockquote>
<p>operator !()<br />
Returns whether the stream has run into an error (corresponds to fail())</p>
</blockquote>
<p>Das heißt, wenn du den !-Operator auf ein fstream-Objekt anwendest (was bei dem if-Konstrukt passiert ist), bekommst du ein true zurück, wenn ein error im fstream ist. Dieser !-Operator macht das gleiche wie fail().</p>
<p>Hätte man also auch machen können:</p>
<pre><code class="language-cpp">if(directory.fail())
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/920180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920180</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Fri, 18 Nov 2005 07:15:07 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 07:15:51 GMT]]></title><description><![CDATA[<p>basic_ifstream ist eine Template-Klasse, die sich um Datei-Operationen kümmert - die kann spezialisiert werden als char (ASCII-Files -&gt; ifstream) oder wchar_t (UNICODE-Files -&gt; wifstream).</p>
<p>Die Anweisung &quot;ifstream dict(s.c_str());&quot; erzeugt ein Stream-Objekt mit dem Namen dict und verbindet es mit der Datei auf Festplatte, deren Name in s steht. Der operator!() eines streams gibt true zurück, wenn mit einer vorigen Datei-Operation (in deinem Beispiel &quot;Datei öffnen&quot;) etwas schief gelaufen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/920182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920182</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 18 Nov 2005 07:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 07:20:06 GMT]]></title><description><![CDATA[<p>Theresa_Orl schrieb:</p>
<blockquote>
<p>Und kann man mir erklären, wie diese Zeile hier zu verstehen ist:</p>
<pre><code class="language-cpp">typedef basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; ifstream;
</code></pre>
<p>Danke.</p>
</blockquote>
<p>Ist nur ein typedef. Also eine Art &quot;Alias&quot;. basic_ifstream ist ein Template und es wäre nervig wenn man immer basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; schreiben müsste. ALso gibt es schon eine Typdefinition (aha! typedef!) die ifstream heißt, die man sich auch einfacher merken kann. Hättest aber auch das schreiben können:</p>
<pre><code class="language-cpp">basic_ifstream&lt;char, char_traits&lt;char&gt; &gt; directory(&quot;irgendwas&quot;);
</code></pre>
<p>Wäre aber ziemlich nervig. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/920184</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920184</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Fri, 18 Nov 2005 07:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to ifstream on Fri, 18 Nov 2005 10:25:54 GMT]]></title><description><![CDATA[<p>Gut.. ok. Vielen Dank für Eure Hilfe.<br />
Werde wohl mal mit Operatorüberladung vorlieb nehmen müssen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/920383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920383</guid><dc:creator><![CDATA[Theresa_Orl]]></dc:creator><pubDate>Fri, 18 Nov 2005 10:25:54 GMT</pubDate></item></channel></rss>