<?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[Zahlen aus Datei lesen und ich einer Variable speichern]]></title><description><![CDATA[<p>Hi ich habe ein Problem und zwar ich will Zahlen (positiv und negativ) aus einer Datei laden die immer durch ein Leerzeichen getrennt sind.</p>
<p>hier ein Bsp:</p>
<p>26.363998 -0.000000 -10.550499<br />
26.363998 0.000000 10.550499<br />
26.363998 -0.000000 -10.550499</p>
<p>Die will ich dann immer in einem Double Array speichern. Aber es muss schon die ganze Zahl sein also<br />
double Bla[0]=26.363998<br />
double Bla[1]= - 0.000000<br />
usw.<br />
ich hoffe ihr könnt mir weiter helfen ich habe keine Ahnung wie ich das machen soll und jede Ziffer einzeln speichern will ich nicht<br />
mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/195030/zahlen-aus-datei-lesen-und-ich-einer-variable-speichern</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 18:39:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/195030.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Oct 2007 22:47:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 22:47:40 GMT]]></title><description><![CDATA[<p>Hi ich habe ein Problem und zwar ich will Zahlen (positiv und negativ) aus einer Datei laden die immer durch ein Leerzeichen getrennt sind.</p>
<p>hier ein Bsp:</p>
<p>26.363998 -0.000000 -10.550499<br />
26.363998 0.000000 10.550499<br />
26.363998 -0.000000 -10.550499</p>
<p>Die will ich dann immer in einem Double Array speichern. Aber es muss schon die ganze Zahl sein also<br />
double Bla[0]=26.363998<br />
double Bla[1]= - 0.000000<br />
usw.<br />
ich hoffe ihr könnt mir weiter helfen ich habe keine Ahnung wie ich das machen soll und jede Ziffer einzeln speichern will ich nicht<br />
mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384194</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Fri, 12 Oct 2007 22:47:40 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 22:53:57 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::ifstream file_stream(&quot;data.dat&quot;);
if (!file_stream) return false;
std::vector&lt;double&gt; data;
std::copy(std::istream_iterator&lt;double&gt;(file_stream), std__istream_iterator&lt;double&gt;(), std::back_inserter(data));
</code></pre>
<p>und in data stehen alle Daten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384195</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384195</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 12 Oct 2007 22:53:57 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 23:18:49 GMT]]></title><description><![CDATA[<p>Danke für die Antwort</p>
<p>Ich habe noch nie was mit vector&lt;datentyp&gt;... gemacht<br />
bei mir kommt da`vector' is not a member of `std'<br />
und wenn ich oben using namespace std; mache und es dann bei vector weg lasse kommt<br />
`vector' undeclared (first use this function)</p>
<p>mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384198</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Fri, 12 Oct 2007 23:18:49 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 23:29:47 GMT]]></title><description><![CDATA[<p>Achso ich muss #include &lt;vector&gt; und #include &lt;iterator&gt; einbinden</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384199</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Fri, 12 Oct 2007 23:29:47 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 23:41:16 GMT]]></title><description><![CDATA[<p>Wie bekomme ich die Daten dann aus data raus?</p>
<p>mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384203</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Fri, 12 Oct 2007 23:41:16 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 23:39:25 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p><a href="http://www.cppreference.com/cppvector/index.html" rel="nofollow">in der cpp-reference</a> sind die Memberfunktionen von vector aufgeführt....<br />
Hier doch super-easy: data[i] liefert Dir das i. Element....zum Lesen oder schreiben.<br />
Also genauso wie ein Array - aber vector kann halt viel mehr (vA bei der Aadministration&quot;).</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384204</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384204</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Fri, 12 Oct 2007 23:39:25 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Fri, 12 Oct 2007 23:42:59 GMT]]></title><description><![CDATA[<p>Das Problem ist halt ich habe mich noch nicht mit Templates und STL beschäftigt gibt es vielleicht auch noch ne andere Möglichkeit ?<br />
Oder muss ich das wohl oder übel lernen?</p>
<p>mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384206</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384206</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Fri, 12 Oct 2007 23:42:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Sat, 13 Oct 2007 00:45:55 GMT]]></title><description><![CDATA[<p>Das ist kein übel sondern die komfortabelste Möglichkeit die du hast <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /> Kannst den ganzen Inhalt sogar mit nur 1ner Zeile ausgeben lassen <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="🙂"
    /> (s. std::copy + std::ostream_iterator) <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/1384217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384217</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 13 Oct 2007 00:45:55 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Sat, 13 Oct 2007 05:01:59 GMT]]></title><description><![CDATA[<p>Ist das ne Übung? Wenn ja, dann würde sie bei deinem Kenntnissstand vollkommen die Wirkung verlieren, wenn du sie mit std::copy, std::back_inserter und solchen Hilfsmitteln löst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384225</guid><dc:creator><![CDATA[sagmal]]></dc:creator><pubDate>Sat, 13 Oct 2007 05:01:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Sat, 13 Oct 2007 11:27:09 GMT]]></title><description><![CDATA[<p>Ok danke mal für eure Antworte ich werde es mal versuchen hin zu bekommen<br />
mfg Fabi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384335</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Sat, 13 Oct 2007 11:27:09 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Sat, 13 Oct 2007 11:27:33 GMT]]></title><description><![CDATA[<p>Fabi86 schrieb:</p>
<blockquote>
<p>Das Problem ist halt ich habe mich noch nicht mit Templates und STL beschäftigt gibt es vielleicht auch noch ne andere Möglichkeit ?<br />
...</p>
</blockquote>
<p>Du kannst es auch mit Bytefummelei, viel Schweiß und Tränen, 5mal so langem Code, zukünftiger Unwartbarkeit/-übersichtlichkeit und gelegentlichen Bufferoverflows/Speicherlecks im Betrieb programmieren.</p>
<p>Ich würde aber doch lieber die 2 Stunden &quot;Einarbeitung&quot; investieren und dann in 2 Stunden und 5 Minuten fertig sein (bei zukünftigen Projekten dan nur noch die 5 Minuten). :p <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="😉"
    /> <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=";D"
      alt="😉"
    /></p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384336</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Sat, 13 Oct 2007 11:27:33 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlen aus Datei lesen und ich einer Variable speichern on Sat, 13 Oct 2007 11:38:59 GMT]]></title><description><![CDATA[<p>@sagmal ich beschäftige mich gerade mit OpenGL und daher wollte ich ein .obj File Reader programmieren. Darum ist es mehr oder weniger ne Übung wäre aber schon super wenn das Funktionieren würde.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13624">@Simon2</a> Ok das ist ein gute Argument ich werde es versuchen zu lernen</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1384341</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1384341</guid><dc:creator><![CDATA[Fabi86]]></dc:creator><pubDate>Sat, 13 Oct 2007 11:38:59 GMT</pubDate></item></channel></rss>