<?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[fstream Problem: Nicht alles wird gespeichert]]></title><description><![CDATA[<p>hi erstmal^^</p>
<p>so zu meinem Problem: Ich hab ein Programm geschrieben was ein Dreidimensionales Array schreibt und von jede Position als Adresse ausgebe. Soweit so gut das Funktioniert. Doch ich möchte diese Adressen auch in einer .txt Datei speichern was leider nicht funktioniert da nur ein Teil gespeichert wird (bei mir 28 Zeilen von 36). Woran könnte das liegen? i-jemand eine Idee?</p>
<p>Hier der Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

using namespace std;

int main ()
{
	int t;

	fstream file;
	file.open (&quot;adressen.txt&quot;, ios::out | ios::app);

	int var [6][6][6];

	for (int a=0;a&lt;6;a++)
	{
		for (int b=0;b&lt;6;b++)
		{
			for (int c=0;c&lt;6;c++)
			{
				cout &lt;&lt; &amp;var [a][b][c] &lt;&lt; &quot; &quot;;
				file &lt;&lt; &amp;var [a][b][c] &lt;&lt; &quot; &quot;;
			}
			cout &lt;&lt; &quot;\n&quot;;
			file &lt;&lt; &quot;\n&quot;;
		}
		cout &lt;&lt; &quot;\n&quot;;
		file &lt;&lt; &quot;\n&quot;;
	}

	cout &lt;&lt; &quot;\n&quot;;

	cout &lt;&lt; &quot;Gesamtgroese : &quot; &lt;&lt; sizeof (var) &lt;&lt; &quot; Bytes\n&quot;;
	cout &lt;&lt; &quot;Einzelgroese : &quot; &lt;&lt; sizeof (var[0]) &lt;&lt; &quot; Bytes\n&quot;;
	cout &lt;&lt; &quot;Anzahl Elemente : &quot; &lt;&lt; sizeof (var) / sizeof (var[0]) &lt;&lt; &quot;\n&quot;;

	while (1);
}
</code></pre>
<p>mfg<br />
the.specialist</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/219201/fstream-problem-nicht-alles-wird-gespeichert</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 08:53:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/219201.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 30 Jul 2008 17:31:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fstream Problem: Nicht alles wird gespeichert on Wed, 30 Jul 2008 17:31:47 GMT]]></title><description><![CDATA[<p>hi erstmal^^</p>
<p>so zu meinem Problem: Ich hab ein Programm geschrieben was ein Dreidimensionales Array schreibt und von jede Position als Adresse ausgebe. Soweit so gut das Funktioniert. Doch ich möchte diese Adressen auch in einer .txt Datei speichern was leider nicht funktioniert da nur ein Teil gespeichert wird (bei mir 28 Zeilen von 36). Woran könnte das liegen? i-jemand eine Idee?</p>
<p>Hier der Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

using namespace std;

int main ()
{
	int t;

	fstream file;
	file.open (&quot;adressen.txt&quot;, ios::out | ios::app);

	int var [6][6][6];

	for (int a=0;a&lt;6;a++)
	{
		for (int b=0;b&lt;6;b++)
		{
			for (int c=0;c&lt;6;c++)
			{
				cout &lt;&lt; &amp;var [a][b][c] &lt;&lt; &quot; &quot;;
				file &lt;&lt; &amp;var [a][b][c] &lt;&lt; &quot; &quot;;
			}
			cout &lt;&lt; &quot;\n&quot;;
			file &lt;&lt; &quot;\n&quot;;
		}
		cout &lt;&lt; &quot;\n&quot;;
		file &lt;&lt; &quot;\n&quot;;
	}

	cout &lt;&lt; &quot;\n&quot;;

	cout &lt;&lt; &quot;Gesamtgroese : &quot; &lt;&lt; sizeof (var) &lt;&lt; &quot; Bytes\n&quot;;
	cout &lt;&lt; &quot;Einzelgroese : &quot; &lt;&lt; sizeof (var[0]) &lt;&lt; &quot; Bytes\n&quot;;
	cout &lt;&lt; &quot;Anzahl Elemente : &quot; &lt;&lt; sizeof (var) / sizeof (var[0]) &lt;&lt; &quot;\n&quot;;

	while (1);
}
</code></pre>
<p>mfg<br />
the.specialist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1556551</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1556551</guid><dc:creator><![CDATA[the.specialist]]></dc:creator><pubDate>Wed, 30 Jul 2008 17:31:47 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Problem: Nicht alles wird gespeichert on Wed, 30 Jul 2008 18:47:21 GMT]]></title><description><![CDATA[<p>Du solltest ev. zuerst mal noch was reinfüllen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Ansonsten sehe ich kein Problem.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1556597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1556597</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 30 Jul 2008 18:47:21 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Problem: Nicht alles wird gespeichert on Wed, 30 Jul 2008 20:02:09 GMT]]></title><description><![CDATA[<p>ahh bin ich *** So hab den Fehler jetzt selber gefunden. Man sollte natürlich auch nachdem man die Schleifen durschlaufen hat den file schließen mit file.close() aber warum gerade das diesen Fehler verursacht hat bleibt mir weiterhin ein rätsel.</p>
<p>Trotzdem thx^^</p>
<p>mfg<br />
the.specialist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1556652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1556652</guid><dc:creator><![CDATA[the.specialist]]></dc:creator><pubDate>Wed, 30 Jul 2008 20:02:09 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Problem: Nicht alles wird gespeichert on Wed, 30 Jul 2008 20:18:46 GMT]]></title><description><![CDATA[<p>the.specialist schrieb:</p>
<blockquote>
<p>ahh bin ich *** So hab den Fehler jetzt selber gefunden. Man sollte natürlich auch nachdem man die Schleifen durschlaufen hat den file schließen mit file.close() aber warum gerade das diesen Fehler verursacht hat bleibt mir weiterhin ein rätsel.</p>
<p>Trotzdem thx^^</p>
<p>mfg<br />
the.specialist</p>
</blockquote>
<p>Das war sicher nicht das Problem. Das ist ja das schöne an Objekten und RAII. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Das schliesst sich schon von selbst, wenn main verlassen wird. Mich dünkt eher, dass du wirklich irgendwlche Zufallsdaten drin hattest, wo dann hald irgendwann nichts mehr gekommen ist. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1556664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1556664</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 30 Jul 2008 20:18:46 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Problem: Nicht alles wird gespeichert on Thu, 31 Jul 2008 06:08:08 GMT]]></title><description><![CDATA[<p>Desweiteren ist dort nirgends ein flush zu sehen, daher wird auch jede Ausgabe gebuffert, so daß evtl. der neueste Eintrag (oder mehr) fehlen. Da du das Programm auch nicht beendest, sondern in eine Endlosschleife laufen läßt, wird der Buffer wohl auch nicht mehr geschrieben.</p>
<p>Flushen geht zB ganz einfach mit endl statt &quot;\n&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1556762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1556762</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 31 Jul 2008 06:08:08 GMT</pubDate></item></channel></rss>