<?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[Vector speichern]]></title><description><![CDATA[<p>Hallo, ich suche eine Möglichkeit einen Vector zu speichern und beim nächsten Programmstart wieder zu verwenden.</p>
<p>Also nicht den Inhalt sondern den ganzen Vector.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/313009/vector-speichern</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 08:35:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/313009.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Jan 2013 15:42:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:42:44 GMT]]></title><description><![CDATA[<p>Hallo, ich suche eine Möglichkeit einen Vector zu speichern und beim nächsten Programmstart wieder zu verwenden.</p>
<p>Also nicht den Inhalt sondern den ganzen Vector.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291343</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291343</guid><dc:creator><![CDATA[grimmreefer]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:42:44 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:46:38 GMT]]></title><description><![CDATA[<p>grimmreefer schrieb:</p>
<blockquote>
<p>Hallo, ich suche eine Möglichkeit einen Vector zu speichern und beim nächsten Programmstart wieder zu verwenden.</p>
<p>Also nicht den Inhalt sondern den ganzen Vector.</p>
</blockquote>
<p>Möglich schon. Aber keine gute Idee. Auf einem anderen System funktioniert es schon nicht mehr...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291345</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291345</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:46:38 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:52:59 GMT]]></title><description><![CDATA[<p>Kein Problem, ist nur für mich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291347</guid><dc:creator><![CDATA[grimmreefer]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:52:59 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:54:35 GMT]]></title><description><![CDATA[<p>grimmreefer schrieb:</p>
<blockquote>
<p>Kein Problem, ist nur für mich.</p>
</blockquote>
<p>Schau dir mal ostream::write an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291349</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:54:35 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:55:53 GMT]]></title><description><![CDATA[<p>und istream::read</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291350</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291350</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:55:56 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Möglich schon. Aber keine gute Idee. Auf einem anderen System funktioniert es schon nicht mehr...</p>
</blockquote>
<p>Funktioniert wahrscheinlich schon auf dem selben System nicht mehr, wenn man nix um die Interna der Implementierung weiss.</p>
<p>Ist eine doofe Idee. Warum sollte man das machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291351</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291351</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:55:56 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 15:58:38 GMT]]></title><description><![CDATA[<p>grimmreefer schrieb:</p>
<blockquote>
<p>Also nicht den Inhalt sondern den ganzen Vector.</p>
</blockquote>
<p>Erzähl mal, was für dich da der Unterschied ist und wozu du das brauchst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291352</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Sat, 19 Jan 2013 15:58:38 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 16:00:45 GMT]]></title><description><![CDATA[<p>Warum willst du ihn den ganz speichern?<br />
Den Inhalt abzuspeichern ist ganz einfach:</p>
<pre><code>std::ostream_iterator&lt;DeinTyp&gt; osit(file, &quot; &quot;);
file &lt;&lt; vector.size() &lt;&lt; &quot; &quot;;
std::copy(vector.begin(), vector.end(), osit);
</code></pre>
<p>Und laden ist nur ein bisschen schwieriger.</p>
<pre><code>std::istream_iterator&lt;DeinTyp&gt; isit(file);
std::istream_iterator&lt;DeinTyp&gt; eof;
std::size_t size;
file &gt;&gt; size;
vector.resize(size);
std::copy(isit, eof, vector.begin());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2291353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291353</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sat, 19 Jan 2013 16:00:45 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 16:24:39 GMT]]></title><description><![CDATA[<p>Athar schrieb:</p>
<blockquote>
<p>grimmreefer schrieb:</p>
<blockquote>
<p>Also nicht den Inhalt sondern den ganzen Vector.</p>
</blockquote>
<p>Erzähl mal, was für dich da der Unterschied ist und wozu du das brauchst.</p>
</blockquote>
<p>Der Vector ist ein vector&lt;struct&gt; mit 1 Int und 1 String.</p>
<p>Ich möchte den vector laden können und weitere Elemente einfügen können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291360</guid><dc:creator><![CDATA[grimmreefer]]></dc:creator><pubDate>Sat, 19 Jan 2013 16:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 16:37:56 GMT]]></title><description><![CDATA[<p>Siehe meinen Beitrag.<br />
Die strcut muss nur einen operator&lt;&lt; haben.</p>
<p>Edit: Und zum Speichern natürlich auch operator&gt;&gt;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291362</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sat, 19 Jan 2013 16:37:56 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 16:29:23 GMT]]></title><description><![CDATA[<p>grimmreefer schrieb:</p>
<blockquote>
<p>Der Vector ist ein vector&lt;struct&gt; mit 1 Int und 1 String.</p>
<p>Ich möchte den vector laden können und weitere Elemente einfügen können.</p>
</blockquote>
<p>Na also. Dann möchtest du doch den Inhalt speichern und laden.<br />
Wenn du operator&gt;&gt;/&lt;&lt; für deine Klasse überlädst, kannst du das so machen, wie Nathan gezeigt hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291364</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291364</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Sat, 19 Jan 2013 16:29:23 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sat, 19 Jan 2013 16:35:23 GMT]]></title><description><![CDATA[<p>grimmreefer schrieb:</p>
<blockquote>
<p>Der Vector ist ein vector&lt;struct&gt; mit 1 Int und 1 String.</p>
</blockquote>
<p>Du baust aber keine <code>std::map</code> nach, um strings mit Integern zu identifizieren, oder?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;map&gt;
#include &lt;string&gt;

int main(){
  using namespace std;
  // 4 Nachrichten durch einen int identifiziert:
  map&lt;int, string&gt; messages
  {
    { 3, &quot;!\n&quot; },
    { 0, &quot;Hallo&quot; },
    { 2, &quot;Welt&quot; },
    { 1, &quot;, &quot; },

  };
  for(int i=0; i&lt;4; ++i)
    std::cout &lt;&lt; messages[i];
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2291370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291370</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Sat, 19 Jan 2013 16:35:23 GMT</pubDate></item><item><title><![CDATA[Reply to Vector speichern on Sun, 20 Jan 2013 16:19:24 GMT]]></title><description><![CDATA[<p>Furble Wurble schrieb:</p>
<blockquote>
<p>grimmreefer schrieb:</p>
<blockquote>
<p>Der Vector ist ein vector&lt;struct&gt; mit 1 Int und 1 String.</p>
</blockquote>
<p>Du baust aber keine <code>std::map</code> nach, um strings mit Integern zu identifizieren, oder?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;map&gt;
#include &lt;string&gt;

int main(){
  using namespace std;
  // 4 Nachrichten durch einen int identifiziert:
  map&lt;int, string&gt; messages
  {
    { 3, &quot;!\n&quot; },
    { 0, &quot;Hallo&quot; },
    { 2, &quot;Welt&quot; },
    { 1, &quot;, &quot; },

  };
  for(int i=0; i&lt;4; ++i)
    std::cout &lt;&lt; messages[i];
}
</code></pre>
</blockquote>
<p>Das kannte ich noch gar nicht.<br />
Also nein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Auf jeden Fall mal danke für die ganzen Antworten. Mal schauen was ich zusammen bringe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2291655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2291655</guid><dc:creator><![CDATA[grimmreefer]]></dc:creator><pubDate>Sun, 20 Jan 2013 16:19:24 GMT</pubDate></item></channel></rss>