<?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[string in klasse]]></title><description><![CDATA[<p>hallo erstmal,</p>
<p>wie der name schon sagt, habe ich ein string in einer klasse. soweit ist alles gut, aber wenn ich mit set dem string etwas zuweisen möchte, geht das nich.<br />
vielleicht könnte mir jemand sagen, was ich falsch gemacht habe:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

class ein_und_ausgabe
{
	public:
	fstream file;
	string dateiname;

	ein_und_ausgabe();
	void set_dateiname(string text_dateiname);
	void schreiben(string i);
	void schließen();
	~ein_und_ausgabe();

};

ein_und_ausgabe::ein_und_ausgabe()
{
	string i;
	dateiname = &quot;test.txt&quot;;

	file.open(dateiname, ios_base::out);
}

void ein_und_ausgabe::set_dateiname(string text_dateiname)
{
	dateiname = text_dateiname;
}

void ein_und_ausgabe::schreiben(string i)
{
	file &lt;&lt; i;
}

void ein_und_ausgabe::schließen()
{
	file.close();
}

ein_und_ausgabe::~ein_und_ausgabe()
{

}

int main()
{
	ein_und_ausgabe i;
	string a = &quot;2 ist eine Primzahl.txt&quot;;
	i.set_dateiname(a);

	i.schreiben(a);

	return 0;
}
</code></pre>
<p>gruß und dank im voraus</p>
<p>gucky</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275780/string-in-klasse</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 15:07:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275780.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Oct 2010 19:48:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 19:48:20 GMT]]></title><description><![CDATA[<p>hallo erstmal,</p>
<p>wie der name schon sagt, habe ich ein string in einer klasse. soweit ist alles gut, aber wenn ich mit set dem string etwas zuweisen möchte, geht das nich.<br />
vielleicht könnte mir jemand sagen, was ich falsch gemacht habe:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

class ein_und_ausgabe
{
	public:
	fstream file;
	string dateiname;

	ein_und_ausgabe();
	void set_dateiname(string text_dateiname);
	void schreiben(string i);
	void schließen();
	~ein_und_ausgabe();

};

ein_und_ausgabe::ein_und_ausgabe()
{
	string i;
	dateiname = &quot;test.txt&quot;;

	file.open(dateiname, ios_base::out);
}

void ein_und_ausgabe::set_dateiname(string text_dateiname)
{
	dateiname = text_dateiname;
}

void ein_und_ausgabe::schreiben(string i)
{
	file &lt;&lt; i;
}

void ein_und_ausgabe::schließen()
{
	file.close();
}

ein_und_ausgabe::~ein_und_ausgabe()
{

}

int main()
{
	ein_und_ausgabe i;
	string a = &quot;2 ist eine Primzahl.txt&quot;;
	i.set_dateiname(a);

	i.schreiben(a);

	return 0;
}
</code></pre>
<p>gruß und dank im voraus</p>
<p>gucky</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968213</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Wed, 20 Oct 2010 19:48:20 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 19:54:54 GMT]]></title><description><![CDATA[<p>Abgesehen von deinen vielen anderen Fehlern: Was meinst du mit &quot;geht nich&quot;? Die Zuweisung ist eine der wenigen Sachen die bei dir in Ordnung sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968217</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Oct 2010 19:54:54 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 19:56:19 GMT]]></title><description><![CDATA[<p>bin mir nicht sicher aber geht</p>
<p>sprintf(string,text_dateiname);</p>
<p>vll?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968218</guid><dc:creator><![CDATA[zenit_]]></dc:creator><pubDate>Wed, 20 Oct 2010 19:56:19 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 19:59:05 GMT]]></title><description><![CDATA[<p>Ähm, wie &quot;geht nicht&quot;? Wir raten nicht gerne.</p>
<p>Aber einige (unvollstänige) Bemerkungen:</p>
<ul>
<li>Bei zwei Methoden/Funktion wurdne der Rückgabewert void nicht angegeben</li>
<li>Eine wahrscheinlich wichtige Funtkion wurde aufgerufen</li>
<li>Wobei du dessen Inhalt auch in eine andere besondere Funktion hättest einfügen können, welche versteckt aufgerufen wird.</li>
</ul>
]]></description><link>https://www.c-plusplus.net/forum/post/1968220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968220</guid><dc:creator><![CDATA[Rhombicosidodecahedron]]></dc:creator><pubDate>Wed, 20 Oct 2010 19:59:05 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 20:31:32 GMT]]></title><description><![CDATA[<p>zenit_ schrieb:</p>
<blockquote>
<p>sprintf(string,text_dateiname);</p>
</blockquote>
<p>Das wird dir sowas von verrecken, so schnell kannst du gar nicht stack corruption sagen.</p>
<p>Er hat bloß einen seiner anderen Fehler als Fehler bei der Zuweisung interpretiert. Der Zuweisungsoperator ist für std::string selbstverständlich definiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968233</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Oct 2010 20:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 20:47:07 GMT]]></title><description><![CDATA[<p>Ich schätze, du willst den Text in die Datei &quot;2 ist eine Primzahl.txt&quot; schreiben und nicht in test.txt.</p>
<p>Dann solltest du aber auch die test.txt schließen und anschließend deine neue Datei aufmachen. Du weist ja nur in deiner Klasse dem String dateiname den neuen Wert zu. dateiname hat mit der Datei erstmal nichts zu tun hat, du musst erst noch eine Datei mit dem Namen öffnen.</p>
<pre><code class="language-cpp">void ein_und_ausgabe::set_dateiname(string text_dateiname)
{
    file.close(); // Alte Datei schließen
    dateiname = text_dateiname;
    file.open(dateiname, ios_base::out); // Neue Datei öffnen
}
</code></pre>
<p>(ungetestet)</p>
<p>PS.: string i; im Konstruktor ist unnötig, da nicht gebraucht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968242</guid><dc:creator><![CDATA[BitteSC2]]></dc:creator><pubDate>Wed, 20 Oct 2010 20:47:07 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 20:55:04 GMT]]></title><description><![CDATA[<p>Rhombicosidodecahedron schrieb:</p>
<blockquote>
<p>Ähm, wie &quot;geht nicht&quot;? Wir raten nicht gerne.</p>
<p>Aber einige (unvollstänige) Bemerkungen:</p>
<ul>
<li>Bei zwei Methoden/Funktion wurdne der Rückgabewert void nicht angegeben</li>
</ul>
</blockquote>
<p>Hm? Kann ich nicht erkennen, ausser du meinst den Konstruktor und Destruktor.</p>
<blockquote>
<ul>
<li>Eine wahrscheinlich wichtige Funtkion wurde aufgerufen</li>
<li>Wobei du dessen Inhalt auch in eine andere besondere Funktion hättest einfügen können, welche versteckt aufgerufen wird.</li>
</ul>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Mir erschliesst sich nicht ganz wovon du redest <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/1968247</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968247</guid><dc:creator><![CDATA[inter2k3]]></dc:creator><pubDate>Wed, 20 Oct 2010 20:55:04 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 21:14:17 GMT]]></title><description><![CDATA[<p>inter2k3 schrieb:</p>
<blockquote>
<blockquote>
<ul>
<li>Eine wahrscheinlich wichtige Funtkion wurde aufgerufen</li>
<li>Wobei du dessen Inhalt auch in eine andere besondere Funktion hättest einfügen können, welche versteckt aufgerufen wird.</li>
</ul>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Mir erschliesst sich nicht ganz wovon du redest <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>
</blockquote>
<p>Er meint, dass die ein_und_ausgabe-Klasse ohne vorherigen Aufruf von set_dateiname() ganz schlimme Dinge macht, wenn man dann schreiben() aufruft. Sowas gehört daher in den Konstruktor. Zumal der Threadersteller hier völlig sinnlos eigene Konstruktoren und Destruktoren definiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968257</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:14:17 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Wed, 20 Oct 2010 21:27:30 GMT]]></title><description><![CDATA[<p>Was soll denn schlimmes gemacht werden? Es wird der String i in die Datei test.txt geschrieben (die ja im Konstruktor geöffnet wurde). Kann da nichts schlimmes sehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968265</guid><dc:creator><![CDATA[inter2k3]]></dc:creator><pubDate>Wed, 20 Oct 2010 21:27:30 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 03:28:30 GMT]]></title><description><![CDATA[<p>Hmm, ich würd sowas bauen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;exception&gt;
#include &lt;sstream&gt;

class ein_und_ausgabe
{
public: 
   ein_und_ausgabe(std::string dateiname);
   ~ein_und_ausgabe();   

   const std::string&amp; dateiname() const { return m_dateiname; }
   bool istOffen() const { return m_stream.is_open(); }

   std::ofstream&amp; operator&lt;&lt;(const std::string&amp; t);

private:
   std::ofstream m_stream;
   std::string m_dateiname;
};

ein_und_ausgabe::ein_und_ausgabe(std::string dateiname)
: m_dateiname(dateiname)
{
   m_stream.open(dateiname.c_str());
   if ( m_stream.is_open() == false )
   {
      std::stringstream ss;
      ss &lt;&lt; &quot;Kann Datei '&quot; &lt;&lt; m_dateiname &lt;&lt; &quot;' nicht öffnen&quot;;
      throw std::exception(ss.str().c_str());
   }
}

ein_und_ausgabe::~ein_und_ausgabe()
{
   m_stream.close();
}

std::ofstream&amp; ein_und_ausgabe::operator&lt;&lt;(const std::string&amp; t)
{
   m_stream &lt;&lt; t;
   return m_stream;
}

int main()
{
   try
   {
     ein_und_ausgabe ea(&quot;Test.txt&quot;);
     if ( ea.isOffen() )
     {
         ea &lt;&lt; &quot;Hello Stream!&quot;;   
     }
   }
   catch(std::exception&amp; e)
   {
       std::cout &lt;&lt; &quot;Ausnahmefehler! Meldung: &quot; &lt;&lt; e.what() &lt;&lt; std::endl;
   }
}
</code></pre>
<p>Hinweis: Unter msvc kein Problem, aber der mingw (g++) kennt kein exception-constructor der einen string als Fehlermeldung akzeptiert.<br />
Leider ist das im Standard scheinbar nicht definiert wie der Constructor von exception auszusehen hat -.-.<br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968296</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968296</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 21 Oct 2010 03:28:30 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 08:39:23 GMT]]></title><description><![CDATA[<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Leider ist das im Standard scheinbar nicht definiert wie der Constructor von exception auszusehen hat -.-.<br />
rya.</p>
</blockquote>
<p>Doch, das ist definiert. Siehe Standard 18.6.1 1-3<br />
Für std::exception selber gibt es keinen Konstruktor der etwas übernimmt (CopyCtor ausgenommen).<br />
Da muss man sich was draus ableiten, oder die vordefinierten Typen von stdexcept nutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968358</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 21 Oct 2010 08:39:23 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 09:53:38 GMT]]></title><description><![CDATA[<p>@Scorcher24: Warum schließt du die Datei im Destruktor? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968390</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 21 Oct 2010 09:53:38 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 20:34:27 GMT]]></title><description><![CDATA[<p>ok, danke für die vielen antworten, werde sie alle mal in ruhe durchlesen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968733</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Thu, 21 Oct 2010 20:34:27 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 20:40:23 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Leider ist das im Standard scheinbar nicht definiert wie der Constructor von exception auszusehen hat -.-.<br />
rya.</p>
</blockquote>
<p>Doch, das ist definiert. Siehe Standard 18.6.1 1-3<br />
Für std::exception selber gibt es keinen Konstruktor der etwas übernimmt (CopyCtor ausgenommen).<br />
Da muss man sich was draus ableiten, oder die vordefinierten Typen von stdexcept nutzen.</p>
</blockquote>
<p>Hmm, danke aber da finde ich die M$-Implementation echt besser...</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/19375">@SeppJ</a><br />
Warum nicht? Kommt immer drauf an, was man möchte. Es ist zumindest nichts falsches dabei... zumal die Klasse nen reiner Wrapper für ofstream darstellt und eigentlich relativ sinnlos wäre in einem ernsthaften Programm, ausser man implementiert ein gewisses Verhalten beim Lesen&amp;Schreiben.<br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968741</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968741</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 21 Oct 2010 20:40:23 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 20:42:11 GMT]]></title><description><![CDATA[<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Hmm, danke aber da finde ich die M$-Implementation echt besser...</p>
</blockquote>
<p>hat alles vor und nachteile.<br />
string in der exception klasse fuehlt sich aber falsch an, da bad_alloc fliegen koennte...</p>
<blockquote>
<p>Warum nicht?</p>
</blockquote>
<p>weils unnoetig ist. der dtor von fstream raeumt selber auf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968743</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 21 Oct 2010 20:42:11 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 20:51:38 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Hmm, danke aber da finde ich die M$-Implementation echt besser...</p>
</blockquote>
<p>hat alles vor und nachteile.<br />
string in der exception klasse fuehlt sich aber falsch an, da bad_alloc fliegen koennte...</p>
</blockquote>
<p>Hmm, mag sein. Hab das nicht studiert :p. Aber nichts empfinde ich als schlimmer als ständige Exceptions ohne zu wissen wo der Fehler liegt. Gutes Beispiel hierfür wäre CEGUI. Viel zu viel Exceptions ohne gescheite Beschreibung des Fehlers.</p>
<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Warum nicht?</p>
</blockquote>
<p>weils unnoetig ist. der dtor von fstream raeumt selber auf.</p>
</blockquote>
<p>Okay, aber schaden tuts auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    />.<br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968750</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 21 Oct 2010 20:51:38 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 20:56:55 GMT]]></title><description><![CDATA[<p>Scorcher24 schrieb:</p>
<blockquote>
<p>Hmm, mag sein. Hab das nicht studiert :p. Aber nichts empfinde ich als schlimmer als ständige Exceptions ohne zu wissen wo der Fehler liegt. Gutes Beispiel hierfür wäre CEGUI. Viel zu viel Exceptions ohne gescheite Beschreibung des Fehlers.</p>
</blockquote>
<p>Deshalb ist es wichtig tiefe Exception Hierachien zu haben.<br />
Weil eine Fehlerbeschreibung in der Exception ist OK. Aber viel besser ist eine eigene Exception Klasse fuer einen Fehlertyp. Denn dann kann man im Code darauf reagieren. zB die Aktion wiederholen, oder alternativen versuchen.</p>
<p>Wenn nur eine std::exception fliegt, dann kann das alles bedeuten...</p>
<blockquote>
<p>Okay, aber schaden tuts auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
</blockquote>
<p>es schadet der coolness <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/1968756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968756</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 21 Oct 2010 20:56:55 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:09:55 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>Wenn nur eine std::exception fliegt, dann kann das alles bedeuten...</p>
<blockquote>
<p>Okay, aber schaden tuts auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
</blockquote>
<p>es schadet der coolness <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>
</blockquote>
<p>man weiß nicht obs funktionierte und excpetions im detor sind böse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968764</guid><dc:creator><![CDATA[p;sep;se]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:09:55 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:14:32 GMT]]></title><description><![CDATA[<p>p;sep;se schrieb:</p>
<blockquote>
<blockquote>
<p>es schadet der coolness <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>
</blockquote>
<p>man weiß nicht obs funktionierte und excpetions im detor sind böse</p>
</blockquote>
<p>Keine Ahnung was du meinst. Das close im DTor ist unnoetig. Es gibt keine Situation wo es etwas anderes macht als der dtor vom fstream objekt nicht sowieso machen wuerde. exceptions fliegen hier in keinem fall.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968769</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:14:32 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:14:48 GMT]]></title><description><![CDATA[<p>Files im detor schließen ist eigentlich garkeine gute idee</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968770</guid><dc:creator><![CDATA[p;sep;se]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:14:48 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:16:19 GMT]]></title><description><![CDATA[<p>p;sep;se schrieb:</p>
<blockquote>
<p>Files im detor schließen ist eigentlich garkeine gute idee</p>
</blockquote>
<p>Besser als eine close Funktion zu erfinden.</p>
<p>PS: wenn du etwas sagen willst, dann formuliere das bitte aus und poste nicht jeden satz einzeln.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968772</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968772</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:20:34 GMT]]></title><description><![CDATA[<p>Der std::stream der im Detor aufräumt, ist keine gute Idee.<br />
Wenn close noch etwas ins File schreiben muss, weil noch kein flush kam, weißt du nicht obs funktionierte, weil das objekt dann weg ist. Und Exception werfen: <a href="http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.9" rel="nofollow">http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.9</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968776</guid><dc:creator><![CDATA[p;sep;se]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:24:17 GMT]]></title><description><![CDATA[<p>p;sep;se schrieb:</p>
<blockquote>
<p>man weiß nicht obs funktionierte und excpetions im detor sind böse</p>
</blockquote>
<p>Es wird sicher funktionieren, sonst gäbe es keine Funktion close(). Der Destruktor wird intelligent genug sein, ein close bleiben zu lassen, wenn der fstream gerade nicht offen ist. Und close wirft nur eine exception, wenn exceptions für das Objekt aktiviert sind (laut Doku).<br />
Und seit wann sind Exceptions im DTor böse? Ich behaupte das Gegenteil und sage Exceptions im DTor sind was wunderbares!<br />
Das was böse endet ist, wenn eine Exception den DTor verlässt. Wenn wirklich im DTor was passieren kann, musst du das alles fangen.</p>
<p>Ich glaub aber deine Posts gehen stark in Richtung getrolle.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968777</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:24:17 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Thu, 21 Oct 2010 21:36:06 GMT]]></title><description><![CDATA[<p>l'abra d'or schrieb:</p>
<blockquote>
<p>Und close wirft nur eine exception, wenn exceptions für das Objekt aktiviert sind (laut Doku).<br />
Und seit wann sind Exceptions im DTor böse? Ich behaupte das Gegenteil und sage Exceptions im DTor sind was wunderbares!<br />
Das was böse endet ist, wenn eine Exception den DTor verlässt. Wenn wirklich im DTor was passieren kann, musst du das alles fangen.</p>
</blockquote>
<p>Woher weißt du ob std::stream im Detor erfolgreich geschlossen wurde?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968782</guid><dc:creator><![CDATA[p;sep;se]]></dc:creator><pubDate>Thu, 21 Oct 2010 21:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Fri, 22 Oct 2010 07:45:47 GMT]]></title><description><![CDATA[<p>p;sep;se schrieb:</p>
<blockquote>
<p>Woher weißt du ob std::stream im Detor erfolgreich geschlossen wurde?</p>
</blockquote>
<p>Irrelevant, du kannst auf destruktor fail nicht reagieren. und close() ist ein dtor fail.</p>
<p>aber diese diskussion habe ich schon 50mio mal gehabt, such im forum mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1968900</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1968900</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Fri, 22 Oct 2010 07:45:47 GMT</pubDate></item><item><title><![CDATA[Reply to string in klasse on Fri, 22 Oct 2010 17:39:25 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>p;sep;se schrieb:</p>
<blockquote>
<p>Woher weißt du ob std::stream im Detor erfolgreich geschlossen wurde?</p>
</blockquote>
<p>Irrelevant</p>
</blockquote>
<p>Wenn deine Daten nicht wichtig sind, ja.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1969241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1969241</guid><dc:creator><![CDATA[p;sep;se]]></dc:creator><pubDate>Fri, 22 Oct 2010 17:39:25 GMT</pubDate></item></channel></rss>