<?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[STL und speichern]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>ich habe nochmal eine STL Frage:</p>
<p>Kann man die STL - Container auf eine schoene Weise abspeichern oder muss man wirklich jedes Element nacheinander in ein File schreiben? Gibt es Routinen die einen ganzen vector oder lists auf einmal abspeichern und die nachher auch wieder laden?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133489/stl-und-speichern</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 22:57:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133489.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Jan 2006 10:30:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:30:52 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>ich habe nochmal eine STL Frage:</p>
<p>Kann man die STL - Container auf eine schoene Weise abspeichern oder muss man wirklich jedes Element nacheinander in ein File schreiben? Gibt es Routinen die einen ganzen vector oder lists auf einmal abspeichern und die nachher auch wieder laden?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969582</guid><dc:creator><![CDATA[samo]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:41:11 GMT]]></title><description><![CDATA[<p>C++ FAQ lesen:</p>
<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39470.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39470.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/969593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969593</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:41:11 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:44:34 GMT]]></title><description><![CDATA[<p>Hier ein Beispiel, die benötigten Header musst du dir allerdings selber raussuchen.</p>
<pre><code class="language-cpp">int main()
{
	vector&lt; int &gt; vec;
	ofstream out( &quot;bla.txt&quot; );
	for( int i = 0; i &lt; 10; ++i )
		vec.push_back( i );
	copy( vec.begin(), vec.end(), ostream_iterator&lt; int &gt;( out, &quot; &quot; ) );

	out.close();

	ifstream in( &quot;bla.txt&quot; );

	vector&lt; int &gt; newVec;

	copy( istream_iterator&lt; int &gt;( in ), istream_iterator&lt; int &gt;(), back_inserter&lt; vector&lt; int &gt; &gt;( newVec ) );

	cout &lt;&lt; &quot;Testausgabe: \n&quot;;
	copy( newVec.begin(), newVec.end(), ostream_iterator&lt; int &gt;( cout, &quot; &quot; ) );
}
</code></pre>
<p>Wenn du Fragen zu den einzelnen Teilen hast helfe ich/wir dir gerne, aber am besten ist es du schaust dir einfach mal die STL und die C++-Streams genauer an, die beiden sind nämlich sehr mächtig, wie du hier siehst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969595</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969595</guid><dc:creator><![CDATA[Any]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:44:34 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:46:09 GMT]]></title><description><![CDATA[<p>Sehe gerade, dass Hume das in der FAQ schon sehr schön erklärt hat <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/969598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969598</guid><dc:creator><![CDATA[Any]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:46:09 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:48:18 GMT]]></title><description><![CDATA[<p>copy() mit einem ostream_iterator als Ziel:</p>
<pre><code class="language-cpp">void speichere(list&lt;int&gt; values,char* filename)
{
  ofstream fout(filename);
  copy(values.begin(),values.end(),ostream_iterator(fout,'\t');
}
</code></pre>
<p>(das klappt mit jedem STL-Container - und sogar mit deinen eigenen STL-ähnlichen Containern)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969601</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 10:55:32 GMT]]></title><description><![CDATA[<p>Dankeschoen zusammen. Hatte gar nicht mehr an die FAQ gedacht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/969607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969607</guid><dc:creator><![CDATA[Samo]]></dc:creator><pubDate>Wed, 18 Jan 2006 10:55:32 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 11:07:10 GMT]]></title><description><![CDATA[<p>Hmm leider funktioniert das mit dem ostream-iterator so nicht. Da ich eine eigene Klasse entworfen habe und mein vector Elemente dieser Klasse enthaelt bekomme ich die Fehlermeldung:</p>
<p>error C2679: binary '&lt;&lt;' : no operator found which takes a right-hand operand of type 'const PointN' (or there is no acceptable conversion)</p>
<p>Das heisst also fuer mich jetzt den iterator fuer meine PointN-Klasse zu ueberladen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969617</guid><dc:creator><![CDATA[Samo]]></dc:creator><pubDate>Wed, 18 Jan 2006 11:07:10 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 11:11:17 GMT]]></title><description><![CDATA[<p>nein du musst einen op&lt;&lt; schreiben der für deine klasse</p>
<pre><code class="language-cpp">struct Foo
{
 string bla;
};
ostream&amp; operator&lt;&lt;( ostream&amp; out, Foo&amp; obj )
{
 out &lt;&lt; bla;
 return out; //Muss zurückgegeben werden damit ne Verkettung möglich ist
             //Also: cout &lt;&lt; &quot;bla&quot; &lt;&lt; 1 &lt;&lt; Foo() &lt;&lt; &quot;12345&quot; &lt;&lt; endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/969618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969618</guid><dc:creator><![CDATA[Any]]></dc:creator><pubDate>Wed, 18 Jan 2006 11:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 11:21:11 GMT]]></title><description><![CDATA[<p>wenn ich das so versuche dann sagt er mir dass der binary operator&lt;&lt; zuviele Elemente besitzt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969624</guid><dc:creator><![CDATA[samo]]></dc:creator><pubDate>Wed, 18 Jan 2006 11:21:11 GMT</pubDate></item><item><title><![CDATA[Reply to STL und speichern on Wed, 18 Jan 2006 11:31:50 GMT]]></title><description><![CDATA[<p>Kann ich jetzt nicht nachvollziehen, hab dir hier aber mal nen voll funktionsfähiges beispiel gemacht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

struct Foo
{
	Foo( const string&amp; str )
	{
		s = str;
	}
	string s;
};
ostream&amp; operator&lt;&lt;( ostream&amp; out, Foo&amp; obj )
{
	out &lt;&lt; obj.s;
	return out;
}

int main()
{
	Foo f( string(&quot;bla&quot;) );
	cout &lt;&lt; f;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/969633</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969633</guid><dc:creator><![CDATA[Any]]></dc:creator><pubDate>Wed, 18 Jan 2006 11:31:50 GMT</pubDate></item></channel></rss>