<?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[Struct speichern]]></title><description><![CDATA[<p>Aloha!<br />
Hoffe mal ich stell jetz nicht ne frage die schon tausend mal gestellt wurde. Über suchen und FAQ hab ich irgendwie nix gefunden.<br />
Also ich hab ein Program das mehrere AnsiStrings in einem struct speicher. jetzt würd ich gerne beim drücken des entsprechenden Buttons diese in eine Datei speichern.<br />
In der Konsole is das ja mit fstream kein problem, aber das scheint ja mit AnsiStrings nicht zu gehn. Gibt ne vergleichbare Funktion oder so mit der ich meine Daten speichern kann?<br />
Schon mal Danke!</p>
<p>Mit einfachen Strings dürfte das doch in etwa so gehen, oder is das &quot;speichern&lt;&lt;&quot; Konsolen spezifisch?</p>
<pre><code class="language-cpp">if (SaveDialog1-&gt;Execute())
{
   ofstream speichern(SaveDialog1-&gt;FileName);

   for (i=0; i&lt;anzahl; i++)
   {
      speichern&lt;&lt;cars[i].marke&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].typ&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].nummer&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].jahr&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].hub&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].leistung&lt;&lt;endl;
   }
}
</code></pre>
<p>Gruß Seeaal</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/109787/struct-speichern</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 13:52:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/109787.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 May 2005 16:06:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Struct speichern on Fri, 13 May 2005 16:06:01 GMT]]></title><description><![CDATA[<p>Aloha!<br />
Hoffe mal ich stell jetz nicht ne frage die schon tausend mal gestellt wurde. Über suchen und FAQ hab ich irgendwie nix gefunden.<br />
Also ich hab ein Program das mehrere AnsiStrings in einem struct speicher. jetzt würd ich gerne beim drücken des entsprechenden Buttons diese in eine Datei speichern.<br />
In der Konsole is das ja mit fstream kein problem, aber das scheint ja mit AnsiStrings nicht zu gehn. Gibt ne vergleichbare Funktion oder so mit der ich meine Daten speichern kann?<br />
Schon mal Danke!</p>
<p>Mit einfachen Strings dürfte das doch in etwa so gehen, oder is das &quot;speichern&lt;&lt;&quot; Konsolen spezifisch?</p>
<pre><code class="language-cpp">if (SaveDialog1-&gt;Execute())
{
   ofstream speichern(SaveDialog1-&gt;FileName);

   for (i=0; i&lt;anzahl; i++)
   {
      speichern&lt;&lt;cars[i].marke&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].typ&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].nummer&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].jahr&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].hub&lt;&lt;&quot;\n&quot;&lt;&lt;cars[i].leistung&lt;&lt;endl;
   }
}
</code></pre>
<p>Gruß Seeaal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/788085</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/788085</guid><dc:creator><![CDATA[Seeaal]]></dc:creator><pubDate>Fri, 13 May 2005 16:06:01 GMT</pubDate></item><item><title><![CDATA[Reply to Struct speichern on Fri, 13 May 2005 16:13:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>hatte ich erst vor kurzen erst gepostet, aber da ich den Thread nicht mehr finde, nochmal der Auszug aus der BCB-Hilfe zu AnsiString</p>
<blockquote>
<p>Wenn Sie #include &lt;iostream&gt; oder #define VCL_IOSTREAM angeben, bevor Sie die include-Anweisung für die Datei dstring.h (die normalerweise indirekt durch die Datei vcl.h einbezogen wird) festlegen, können Sie die Streaming-Operatoren (&lt;&lt; und &gt;&gt;) mit AnsiStrings als Argument verwenden:</p>
<pre><code class="language-cpp">ostream&amp; operator &lt;&lt; (ostream&amp; os, const AnsiString&amp; arg);
  istream&amp; operator &gt;&gt; (istream&amp; is, AnsiString&amp; arg);
</code></pre>
</blockquote>
<p>Damit kannst du fstream mit AnsiString benutzten.<br />
Oder du kannst statt fstream auch TFileStream, das VCL-Äquivalent benutzen.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/788087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/788087</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Fri, 13 May 2005 16:13:44 GMT</pubDate></item><item><title><![CDATA[Reply to Struct speichern on Fri, 13 May 2005 16:58:41 GMT]]></title><description><![CDATA[<p>Danke dir!<br />
Werd das ganze mal ausprobieren! Aber bin recht zuversuchtlich! <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/788097</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/788097</guid><dc:creator><![CDATA[Seeaal]]></dc:creator><pubDate>Fri, 13 May 2005 16:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to Struct speichern on Tue, 17 May 2005 11:03:44 GMT]]></title><description><![CDATA[<p>Hallo Seeaal,<br />
vor kurzem hab ich dieselbe Frage gestellt und diese wurde ausführlich behandelt:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-107754.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-107754.html</a><br />
Ich hoffe, der Link funktioniert.<br />
ist im Moment auf S. 4 in diesem Forum (Thema: struct array speichern)</p>
<p>Grüße von sehreilig</p>
]]></description><link>https://www.c-plusplus.net/forum/post/790030</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/790030</guid><dc:creator><![CDATA[sehreilig]]></dc:creator><pubDate>Tue, 17 May 2005 11:03:44 GMT</pubDate></item><item><title><![CDATA[Reply to Struct speichern on Wed, 18 May 2005 13:22:25 GMT]]></title><description><![CDATA[<p>link funktioniert! Habs bis jetzt doch noch nicht hinbekommen....hoffe mal das geht jetzt!<br />
Danke und Grüße<br />
Seeaal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/790745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/790745</guid><dc:creator><![CDATA[Seeaal]]></dc:creator><pubDate>Wed, 18 May 2005 13:22:25 GMT</pubDate></item></channel></rss>