<?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[C++ (CPP) Vectoren in Externe Datei abspeichern]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich würde gerne einen Vector mit den Inhalten in eine externe Datei abspeichern und beim Programmstart wieder laden. Jedoch weis ich leider nicht wie das geht.</p>
<p>Ich habe ein kleine Programm geschrieben in C++, in dem ich eine Zahl eingebe diese dann mit PushBack in den Vector anhänge.</p>
<p>Hier der Code:</p>
<pre><code>// Header Datei

#include &lt;vector&gt;
using namespace std;

class datenbank
{
private:
	vector&lt;int&gt;daten;
public:
	void setdaten(int);
};
</code></pre>
<pre><code>// CPP Datei zur HeaderDatei

#include &quot;data.h&quot;

void datenbank::setdaten(int peingabe)
{ 
	daten.push_back(peingabe);
}
</code></pre>
<pre><code>//Und die Main

#include &quot;data.h&quot;
#include &lt;iostream&gt;
using namespace std;

void main()
{
int eingabe;
datenbank daten;

cout &lt;&lt; &quot;Bitte Zahl eingen: &quot;;
cin &gt;&gt; eingabe;

daten.setdaten (eingabe);
}
</code></pre>
<p>Jetzt würde ich den Vector abspeichern. Hoffe ihr könnt mir helfen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/253088/c-cpp-vectoren-in-externe-datei-abspeichern</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 05:08:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/253088.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Oct 2009 13:56:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ (CPP) Vectoren in Externe Datei abspeichern on Wed, 28 Oct 2009 13:56:14 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich würde gerne einen Vector mit den Inhalten in eine externe Datei abspeichern und beim Programmstart wieder laden. Jedoch weis ich leider nicht wie das geht.</p>
<p>Ich habe ein kleine Programm geschrieben in C++, in dem ich eine Zahl eingebe diese dann mit PushBack in den Vector anhänge.</p>
<p>Hier der Code:</p>
<pre><code>// Header Datei

#include &lt;vector&gt;
using namespace std;

class datenbank
{
private:
	vector&lt;int&gt;daten;
public:
	void setdaten(int);
};
</code></pre>
<pre><code>// CPP Datei zur HeaderDatei

#include &quot;data.h&quot;

void datenbank::setdaten(int peingabe)
{ 
	daten.push_back(peingabe);
}
</code></pre>
<pre><code>//Und die Main

#include &quot;data.h&quot;
#include &lt;iostream&gt;
using namespace std;

void main()
{
int eingabe;
datenbank daten;

cout &lt;&lt; &quot;Bitte Zahl eingen: &quot;;
cin &gt;&gt; eingabe;

daten.setdaten (eingabe);
}
</code></pre>
<p>Jetzt würde ich den Vector abspeichern. Hoffe ihr könnt mir helfen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799677</guid><dc:creator><![CDATA[Blackstone]]></dc:creator><pubDate>Wed, 28 Oct 2009 13:56:14 GMT</pubDate></item><item><title><![CDATA[Reply to C++ (CPP) Vectoren in Externe Datei abspeichern on Wed, 28 Oct 2009 14:08:44 GMT]]></title><description><![CDATA[<p>schau dir mal fstream an. Das bietet eigentlich alles was Du brauchst.<br />
<a href="http://www.cplusplus.com/reference/iostream/fstream/" rel="nofollow">http://www.cplusplus.com/reference/iostream/fstream/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799689</guid><dc:creator><![CDATA[CPPNEWB]]></dc:creator><pubDate>Wed, 28 Oct 2009 14:08:44 GMT</pubDate></item><item><title><![CDATA[Reply to C++ (CPP) Vectoren in Externe Datei abspeichern on Wed, 28 Oct 2009 14:09:15 GMT]]></title><description><![CDATA[<p>Stichwort dafür: Serialisierung</p>
<p>Eine sehr einfach umsetzbare Form wäre es, den Vector Zahl für Zahl, Zeile für Zeile in die Datei zu schreiben und wieder auszulesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799690</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 28 Oct 2009 14:09:15 GMT</pubDate></item><item><title><![CDATA[Reply to C++ (CPP) Vectoren in Externe Datei abspeichern on Wed, 11 Nov 2009 08:54:18 GMT]]></title><description><![CDATA[<p>Danke <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1806339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1806339</guid><dc:creator><![CDATA[Blackstone]]></dc:creator><pubDate>Wed, 11 Nov 2009 08:54:18 GMT</pubDate></item><item><title><![CDATA[Reply to C++ (CPP) Vectoren in Externe Datei abspeichern on Mon, 16 Aug 2010 20:30:03 GMT]]></title><description><![CDATA[<p>Huhu,</p>
<p>gewöhn dir void main() ab. <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39346.html" rel="nofollow">int main() oder void main() ?</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1806481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1806481</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 16 Aug 2010 20:30:03 GMT</pubDate></item></channel></rss>