<?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[eleganter von Datei lesen...]]></title><description><![CDATA[<p>Ich möchte so effizient wie möglich von einer Datei in einem vector lesen...<br />
Habt Ihr eine bessere Idee</p>
<pre><code>#include &lt;iostream&gt;
# include &lt;fstream&gt;
#include &lt;vector&gt;
using namespace std;

int main() {
    vector&lt;float&gt; x;
	float f;
	ifstream infile;
	infile.open (&quot;signal.txt&quot;, ifstream::in);
	while(infile&gt;&gt;f)x.push_back(f);
	infile.close();
	//for(int i=0;i&lt;x.size();++i)cout&lt;&lt;x[i]&lt;&lt;endl;
	return 0;
}
</code></pre>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/137390/eleganter-von-datei-lesen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 17:48:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/137390.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Feb 2006 07:04:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 07:04:38 GMT]]></title><description><![CDATA[<p>Ich möchte so effizient wie möglich von einer Datei in einem vector lesen...<br />
Habt Ihr eine bessere Idee</p>
<pre><code>#include &lt;iostream&gt;
# include &lt;fstream&gt;
#include &lt;vector&gt;
using namespace std;

int main() {
    vector&lt;float&gt; x;
	float f;
	ifstream infile;
	infile.open (&quot;signal.txt&quot;, ifstream::in);
	while(infile&gt;&gt;f)x.push_back(f);
	infile.close();
	//for(int i=0;i&lt;x.size();++i)cout&lt;&lt;x[i]&lt;&lt;endl;
	return 0;
}
</code></pre>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996354</guid><dc:creator><![CDATA[carmen]]></dc:creator><pubDate>Fri, 17 Feb 2006 07:04:38 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 07:32:24 GMT]]></title><description><![CDATA[<p>Ob das wirklich schneller geht, weiß ich nicht, aber es sieht eleganter aus <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>
<pre><code class="language-cpp">std::copy(std::istream_iterator&lt;float&gt;(infile),std::istream_iterator&lt;float&gt;(),std::back_inserte(x));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/996373</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996373</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 17 Feb 2006 07:32:24 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 07:33:48 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;algorithm&gt;
#include &lt;iterator&gt;
#include &lt;vector&gt;
#include &lt;fstream&gt;

int main()
{
   std::ifstream ifs( &quot;signal.txt&quot; );
   std::vector&lt;float&gt; vec;
   std::copy( std::istream_iterator&lt;float&gt;(ifs),
              std::istream_iterator&lt;float(),
              std::back_inserter(vec) );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/996374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996374</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Fri, 17 Feb 2006 07:33:48 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 08:36:39 GMT]]></title><description><![CDATA[<p>Danke für Code! Es ist tatsächlich eleganter...STL ist KLASSE</p>
<p>Als Anfänger muss ich alles noch verdauen.</p>
<p>1. istream_iterator&lt;float&gt;(ifs)-&gt; ein Iterator auf first position von ifs?<br />
2. istream_iterator&lt;float&gt;()-&gt; ????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996422</guid><dc:creator><![CDATA[carmen]]></dc:creator><pubDate>Fri, 17 Feb 2006 08:36:39 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 08:56:11 GMT]]></title><description><![CDATA[<p>Ein Ende-Iterator liegt immer ein Element hinter dem letzten Datum. In diesem Fall könnte der leere istream_iterator als &quot;End-Of-File&quot; angesehen werden (welches sozusagen ein Element hinter dem letzten float in der Datei steht).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996447</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Fri, 17 Feb 2006 08:56:11 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 09:41:32 GMT]]></title><description><![CDATA[<p>Danke!<br />
Hier ist eigentlich alles ganz gut dokumentiert:</p>
<p><a href="http://wwwasd.web.cern.ch/wwwasd/lhc%2B%2B/RW/stdlibcr/ist_4337.htm" rel="nofollow">http://wwwasd.web.cern.ch/wwwasd/lhc%2B%2B/RW/stdlibcr/ist_4337.htm</a></p>
<p>kennt Ihr andere bessere Links als STL reference?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996486</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996486</guid><dc:creator><![CDATA[carmen]]></dc:creator><pubDate>Fri, 17 Feb 2006 09:41:32 GMT</pubDate></item><item><title><![CDATA[Reply to eleganter von Datei lesen... on Fri, 17 Feb 2006 11:17:28 GMT]]></title><description><![CDATA[<p>Meine Lieblingsreferenz ist SGI <a href="http://www.sgi.com/tech/stl/" rel="nofollow">http://www.sgi.com/tech/stl/</a>. Iostreams fehlen zwar, aber für container, string, iteratoren, funktoren, algorithmen usw. ganz brauchbar.</p>
<p>Tommi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996535</guid><dc:creator><![CDATA[tntnet]]></dc:creator><pubDate>Fri, 17 Feb 2006 11:17:28 GMT</pubDate></item></channel></rss>