<?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[Probleme bei Dateiausgabe]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Problem:</p>
<p>Ich möchte gerne Daten in eine Datei ausgeben, und zwar sowohl von meinem Hauptprogramm aus als auch von einer Methode aus, aber habe Probleme bei der Übergabe des Datenstroms.</p>
<p>Zum Schreiben habe ich die Datei wie folgt geöffnet:</p>
<p>ofstream datei(dateipfad_ausgabe.c_str());</p>
<p>Naiverweise habe ich versucht, diesen Strom wie folgt an die Methode zu Übergeben:</p>
<p>void methode(ofstream datei)<br />
{<br />
}</p>
<p>Dies führt jedoch zu folgender Fehlermeldung:<br />
/usr/include/g++/bits/ios_base.h: In copy constructor <code>std::basic\_ios&lt;char, std::char\_traits&lt;char&gt; &gt;::basic\_ios(const std::basic_ios&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)': /usr/include/g++/bits/ios\_base.h:668: error:</code>std::ios_base::ios_base(const<br />
std::ios_base&amp;)' is private<br />
baumstruct_class.cc:1238: error: within this context<br />
/usr/include/g++/streambuf: In copy constructor <code>std::basic_filebuf&lt;char, std::char\_traits&lt;char&gt; &gt;::basic\_filebuf(const std::basic_filebuf&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)': /usr/include/g++/streambuf:921: error:</code>std::basic_streambuf&lt;_CharT,<br />
_Traits&gt;::basic_streambuf(const std::basic_streambuf&lt;_CharT, _Traits&gt;&amp;)<br />
[with _CharT = char, _Traits = std::char_traits&lt;char&gt;]' is private</p>
<p>Kann mir jemand helfen, wie man es richtig macht?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122468/probleme-bei-dateiausgabe</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 02:46:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122468.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Oct 2005 08:35:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme bei Dateiausgabe on Thu, 06 Oct 2005 08:35:41 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Problem:</p>
<p>Ich möchte gerne Daten in eine Datei ausgeben, und zwar sowohl von meinem Hauptprogramm aus als auch von einer Methode aus, aber habe Probleme bei der Übergabe des Datenstroms.</p>
<p>Zum Schreiben habe ich die Datei wie folgt geöffnet:</p>
<p>ofstream datei(dateipfad_ausgabe.c_str());</p>
<p>Naiverweise habe ich versucht, diesen Strom wie folgt an die Methode zu Übergeben:</p>
<p>void methode(ofstream datei)<br />
{<br />
}</p>
<p>Dies führt jedoch zu folgender Fehlermeldung:<br />
/usr/include/g++/bits/ios_base.h: In copy constructor <code>std::basic\_ios&lt;char, std::char\_traits&lt;char&gt; &gt;::basic\_ios(const std::basic_ios&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)': /usr/include/g++/bits/ios\_base.h:668: error:</code>std::ios_base::ios_base(const<br />
std::ios_base&amp;)' is private<br />
baumstruct_class.cc:1238: error: within this context<br />
/usr/include/g++/streambuf: In copy constructor <code>std::basic_filebuf&lt;char, std::char\_traits&lt;char&gt; &gt;::basic\_filebuf(const std::basic_filebuf&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)': /usr/include/g++/streambuf:921: error:</code>std::basic_streambuf&lt;_CharT,<br />
_Traits&gt;::basic_streambuf(const std::basic_streambuf&lt;_CharT, _Traits&gt;&amp;)<br />
[with _CharT = char, _Traits = std::char_traits&lt;char&gt;]' is private</p>
<p>Kann mir jemand helfen, wie man es richtig macht?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/886200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/886200</guid><dc:creator><![CDATA[michi1234]]></dc:creator><pubDate>Thu, 06 Oct 2005 08:35:41 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei Dateiausgabe on Thu, 06 Oct 2005 09:46:03 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Die Fehlermeldungen resultieren daraus, dass du Streams nicht kopieren kannst. (Der Copy-Ctor ist private. Wie du an den Fehlermeldungen siehst.) =&gt; Übergeben den Stream per <em>Referenz</em> an die Methode.</p>
<p>Beispiel:</p>
<pre><code class="language-cpp">void write_os(ostream&amp; os)
{
     os &lt;&lt; &quot;BLUB&quot;;
}
</code></pre>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/886274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/886274</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Thu, 06 Oct 2005 09:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme bei Dateiausgabe on Thu, 06 Oct 2005 09:57:12 GMT]]></title><description><![CDATA[<p>Super, danke.<br />
Probiere ich gleich aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/886287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/886287</guid><dc:creator><![CDATA[michi1234]]></dc:creator><pubDate>Thu, 06 Oct 2005 09:57:12 GMT</pubDate></item></channel></rss>