<?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[Matrix aus txt in [x][x] array speichern]]></title><description><![CDATA[<p>Hi,<br />
ich versuche aus einer txt die nach dem schema (Link zur txt: <a href="http://freetexthost.com/md2uax2zrx" rel="nofollow">http://freetexthost.com/md2uax2zrx</a>)</p>
<p>1;3;55;...<br />
43;12;18;...</p>
<p>aufgebaut ist, die einzelnen Werte auszulesen und in einem array zu speichern, um damit weiter rechnen zu können.</p>
<p>Mein bisheriger Code funktioniert schon fast.<br />
Allerdings wird immer nur die 1. Zeile ausgelesen und ich komm nicht drauf warum.<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox69667" checked="true" /><label for="checkbox69667">zu speichern, dann die nächste Zeile einzulesen und in [1][x] zu speichern.</label></div></p>
<p>Bin für jeden Tip dankbar.</p>
<p>mfg</p>
<pre><code>ifstream f;
    string zeile;
    string array[78][78];
    int pos,i,j,z;
    i=0;
    j=0;
    f.open(&quot;f3.txt&quot;, ios::in);

    if (f.good())
    {

        while (!f.eof())
        {
            getline(f, zeile);

            while(j&lt;78)
            {
            pos = zeile.find( &quot;;&quot; );
            array[i][j] = zeile.substr(0, pos);
            cout&lt;&lt;array[i][j]&lt;&lt;&quot; &quot;;
            zeile = zeile.substr( pos+1 );
            j++;
            }

            i++;
        }
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/271589/matrix-aus-txt-in-x-x-array-speichern</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 11:57:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/271589.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Jul 2010 12:35:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Matrix aus txt in [x][x] array speichern on Sat, 31 Jul 2010 14:00:00 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich versuche aus einer txt die nach dem schema (Link zur txt: <a href="http://freetexthost.com/md2uax2zrx" rel="nofollow">http://freetexthost.com/md2uax2zrx</a>)</p>
<p>1;3;55;...<br />
43;12;18;...</p>
<p>aufgebaut ist, die einzelnen Werte auszulesen und in einem array zu speichern, um damit weiter rechnen zu können.</p>
<p>Mein bisheriger Code funktioniert schon fast.<br />
Allerdings wird immer nur die 1. Zeile ausgelesen und ich komm nicht drauf warum.<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox69667" checked="true" /><label for="checkbox69667">zu speichern, dann die nächste Zeile einzulesen und in [1][x] zu speichern.</label></div></p>
<p>Bin für jeden Tip dankbar.</p>
<p>mfg</p>
<pre><code>ifstream f;
    string zeile;
    string array[78][78];
    int pos,i,j,z;
    i=0;
    j=0;
    f.open(&quot;f3.txt&quot;, ios::in);

    if (f.good())
    {

        while (!f.eof())
        {
            getline(f, zeile);

            while(j&lt;78)
            {
            pos = zeile.find( &quot;;&quot; );
            array[i][j] = zeile.substr(0, pos);
            cout&lt;&lt;array[i][j]&lt;&lt;&quot; &quot;;
            zeile = zeile.substr( pos+1 );
            j++;
            }

            i++;
        }
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1934378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1934378</guid><dc:creator><![CDATA[mueslimann]]></dc:creator><pubDate>Sat, 31 Jul 2010 14:00:00 GMT</pubDate></item><item><title><![CDATA[Reply to Matrix aus txt in [x][x] array speichern on Sat, 31 Jul 2010 12:36:36 GMT]]></title><description><![CDATA[<p>Nimm lieber einen</p>
<p>vector&lt;vector&lt;string&gt;&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1934381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1934381</guid><dc:creator><![CDATA[Icematix]]></dc:creator><pubDate>Sat, 31 Jul 2010 12:36:36 GMT</pubDate></item><item><title><![CDATA[Reply to Matrix aus txt in [x][x] array speichern on Sat, 31 Jul 2010 12:37:34 GMT]]></title><description><![CDATA[<p>Du setzt j nicht auf 0 zurück, wenn du in eine neue Zeile kommst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1934382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1934382</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 31 Jul 2010 12:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to Matrix aus txt in [x][x] array speichern on Sat, 31 Jul 2010 13:08:39 GMT]]></title><description><![CDATA[<p>da dieser programmteil in ein bereits vorhandenes programm, welches auf array ausgelegt ist integriert werden soll, geht das leider nicht.<br />
ausserdem hab ich von vector noch weniger plan als von arrays ;/</p>
<p>// der tip dass ich j nicht auf 0 zurück setze war schonmal gold wert, DANKE</p>
<p>jetzt habe ich allerdings das problem, dass sich mein programm aufhängt sobald das ende der datei erreicht ist (yyy.exe funktioniert nicht mehr...)<br />
verstehe ich nicht, da ich mit while (!f.eof()) gearbeitet habe.</p>
<p>// habe das problem selber gelöst indem ich while (i&lt;78) benutzt habe.</p>
<p>Danke nochmal für den tip!</p>
<p>// jetzt habe ich mich gerade gefreut dass ichs hinbekommen habe, da fällt mir auf, dass ich im array die Werte als integer brauch um damit weiter rechnen zu können.<br />
Könnte ich das mit atoi hinbekommen? Lässt sich das direkt implementieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1934385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1934385</guid><dc:creator><![CDATA[mueslimann]]></dc:creator><pubDate>Sat, 31 Jul 2010 13:08:39 GMT</pubDate></item></channel></rss>