<?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[ostream problem]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>eine Kollegin von mir hat ein C++ Problem und mich um Hilfe gefragt, aber ich find den Fehler auch nicht.</p>
<p>Es ist folgendes:</p>
<pre><code>ostream o;

  o &lt;&lt; setfill('x');
  o &lt;&lt; setw(10) &lt;&lt; &quot;77&quot;;

  cout &lt;&lt; o &lt;&lt; endl;
</code></pre>
<p>Wenn ich das mit gcc compiliere bekomme ich folgende Meldung:</p>
<pre><code>/usr/include/c++/4.1.2/ostream: In function 'int main()':
/usr/include/c++/4.1.2/ostream:341: error: 'std::basic_ostream&lt;_CharT, _Traits&gt;::basic_ostream() [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]' is protected
test.cpp:8: error: within this context
</code></pre>
<p>Danke schon mal im vorraus.</p>
<p>Mfg Cpt.Hawk</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/234451/ostream-problem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 10:33:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/234451.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Feb 2009 10:30:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ostream problem on Wed, 18 Feb 2009 10:30:42 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>eine Kollegin von mir hat ein C++ Problem und mich um Hilfe gefragt, aber ich find den Fehler auch nicht.</p>
<p>Es ist folgendes:</p>
<pre><code>ostream o;

  o &lt;&lt; setfill('x');
  o &lt;&lt; setw(10) &lt;&lt; &quot;77&quot;;

  cout &lt;&lt; o &lt;&lt; endl;
</code></pre>
<p>Wenn ich das mit gcc compiliere bekomme ich folgende Meldung:</p>
<pre><code>/usr/include/c++/4.1.2/ostream: In function 'int main()':
/usr/include/c++/4.1.2/ostream:341: error: 'std::basic_ostream&lt;_CharT, _Traits&gt;::basic_ostream() [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]' is protected
test.cpp:8: error: within this context
</code></pre>
<p>Danke schon mal im vorraus.</p>
<p>Mfg Cpt.Hawk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1665628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1665628</guid><dc:creator><![CDATA[cpt.hawk]]></dc:creator><pubDate>Wed, 18 Feb 2009 10:30:42 GMT</pubDate></item><item><title><![CDATA[Reply to ostream problem on Wed, 18 Feb 2009 10:37:13 GMT]]></title><description><![CDATA[<p>Was soll denn der Code bewirken? Wenn du eine formatierte Ausgabe erzeugen willst setze doch bitt die Formatierungsflags für cout und nicht für diesen ostream. Es gibt eben keinen operator&lt;&lt; zur Ausgabe von Streams. Alternativ wäre wohl auch die Verwendung eines stringstreams möglich.</p>
<pre><code class="language-cpp">stringstream o;

  o &lt;&lt; setfill('x');
  o &lt;&lt; setw(10) &lt;&lt; &quot;77&quot;;

  cout &lt;&lt; o.str() &lt;&lt; endl; // str gibt ein std::string zurück
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1665636</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1665636</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 18 Feb 2009 10:37:13 GMT</pubDate></item><item><title><![CDATA[Reply to ostream problem on Wed, 18 Feb 2009 10:40:02 GMT]]></title><description><![CDATA[<p>Das ursächliche Problem ist, dass Du kein Objekt eines Outputstreams erzeugen kannst. Wohin sollte der auch ausgeben? Du kannst nur ein Objekte eines Output<strong>file</strong>streams oder eines Output<strong>string</strong>streams etc. erzeugen.</p>
<p>Letzterer heisst std::ostringstream und findet sich in &lt;sstream&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1665637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1665637</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Wed, 18 Feb 2009 10:40:02 GMT</pubDate></item><item><title><![CDATA[Reply to ostream problem on Wed, 18 Feb 2009 11:27:51 GMT]]></title><description><![CDATA[<p>Hier die passende Referenz dazu:<br />
<a href="http://www.cplusplus.com/reference/iostream/ostream/ostream.html" rel="nofollow">http://www.cplusplus.com/reference/iostream/ostream/ostream.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1665651</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1665651</guid><dc:creator><![CDATA[krabbels]]></dc:creator><pubDate>Wed, 18 Feb 2009 11:27:51 GMT</pubDate></item><item><title><![CDATA[Reply to ostream problem on Wed, 18 Feb 2009 12:26:15 GMT]]></title><description><![CDATA[<p>vielen dank, damit komm ich weiter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1665680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1665680</guid><dc:creator><![CDATA[cpt.hawk]]></dc:creator><pubDate>Wed, 18 Feb 2009 12:26:15 GMT</pubDate></item></channel></rss>