<?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[.txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot;]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Es ist ja immer wieder verwunderlich, an welch scheinbar leichten Aufgaben man scheitern kann. Ich zumindest verstehe nicht, wieso bei diesem Code trotzdem jede Zeile in die neue Datei geschrieben wird... Testweise Ausgabe von i ergab, dass korrekt gezählt wird, daher dürfe i%2 == 0 nicht immer wahr sein...</p>
<pre><code>int main()
{
    std::vector&lt;std::string&gt; temp_lines;
    int i = 0;

    std::fstream file( &quot;&lt;Pfad&gt;/Log.txt&quot; );
    while( file.is_open() )
    {
        if( i%2 == 0 )
        {
            std::string line;
            std::getline( file, line, '\n' );
            temp_lines.push_back( line );
        }
        if( file.eof() ) break;
        ++i;      
    }

    std::fstream write( &quot;&lt;Pfad&gt;/Log_Edit.txt&quot; );
    if( write.is_open() )
        for( std::size_t i = 0; i &lt; temp_lines.size(); ++i )
        {
            write &lt;&lt; temp_lines[i] &lt;&lt; '\n';
        }
}
</code></pre>
<p>Kann mir bitte jemand auf die Sprünge helfen?</p>
<p>gewollte Zeile<br />
ungewollte Zeile<br />
gewollte Zweile<br />
ungewollte Zweile<br />
...</p>
<p>Möchte nur die gewollten Zeilen ! <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>
<p>vielen Dank im &lt;edit: Voraus &gt;, ich grübel schonmal weiter...</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/320672/txt-datei-jede-zweite-zeile-quot-auslassen-quot</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 20:47:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/320672.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Oct 2013 14:25:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:26:22 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Es ist ja immer wieder verwunderlich, an welch scheinbar leichten Aufgaben man scheitern kann. Ich zumindest verstehe nicht, wieso bei diesem Code trotzdem jede Zeile in die neue Datei geschrieben wird... Testweise Ausgabe von i ergab, dass korrekt gezählt wird, daher dürfe i%2 == 0 nicht immer wahr sein...</p>
<pre><code>int main()
{
    std::vector&lt;std::string&gt; temp_lines;
    int i = 0;

    std::fstream file( &quot;&lt;Pfad&gt;/Log.txt&quot; );
    while( file.is_open() )
    {
        if( i%2 == 0 )
        {
            std::string line;
            std::getline( file, line, '\n' );
            temp_lines.push_back( line );
        }
        if( file.eof() ) break;
        ++i;      
    }

    std::fstream write( &quot;&lt;Pfad&gt;/Log_Edit.txt&quot; );
    if( write.is_open() )
        for( std::size_t i = 0; i &lt; temp_lines.size(); ++i )
        {
            write &lt;&lt; temp_lines[i] &lt;&lt; '\n';
        }
}
</code></pre>
<p>Kann mir bitte jemand auf die Sprünge helfen?</p>
<p>gewollte Zeile<br />
ungewollte Zeile<br />
gewollte Zweile<br />
ungewollte Zweile<br />
...</p>
<p>Möchte nur die gewollten Zeilen ! <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>
<p>vielen Dank im &lt;edit: Voraus &gt;, ich grübel schonmal weiter...</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358571</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:26:22 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:29:44 GMT]]></title><description><![CDATA[<p>Abgesehen von deiner Art, das Problem zu lösen, bei der ich dir gerade nicht weiter helfen kann:</p>
<p>Warum schreibst du nicht zwei Mal <code>getline();</code> , verwendest aber nur jeweils die, welche du haben möchstest?<br />
Also in diesem Fall immer die erste?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358574</guid><dc:creator><![CDATA[phanzy]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:29:44 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:32:56 GMT]]></title><description><![CDATA[<p>Hihi ok, hat in dem Sinne funktioniert, danke <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="🙂"
    /> Auf sowas wär ich nie gekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f4a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--light_bulb"
      title=":bulb:"
      alt="💡"
    /></p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358579</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:32:56 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:33:31 GMT]]></title><description><![CDATA[<p>Du liest nur bei jedem zweiten Durchgang eine Zeile. Das ist nicht das, was du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358580</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:33:31 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:34:06 GMT]]></title><description><![CDATA[<p>phanzy schrieb:</p>
<blockquote>
<p>Warum schreibst du nicht zwei Mal <code>getline();</code> , verwendest aber nur jeweils die, welche du haben möchstest?<br />
Also in diesem Fall immer die erste?</p>
</blockquote>
<p>Oder besser noch, einmal getline, einmal ignore bis zum nächsten Zeilenumbruch. getline macht intern durchaus komplexe Dinge (zumindest die string-Version), die man sich lieber sparen will, wenn man sie nicht braucht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358581</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358581</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:34:06 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:38:59 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Du liest nur bei jedem zweiten Durchgang eine Zeile. Das ist nicht das, was du willst.</p>
</blockquote>
<p>Aaach *facepalm*, klar! Immer diese Denkfehler.</p>
<p>Noch eine frage ...<br />
std::cin.ignore( &lt;was muss denn hier rein?&gt;, '\n'); &lt;- so gemeint?</p>
<p>Aber sonst, das macht prinzipiell in meinem Fall keinen Unterschied...</p>
<p>Vielen Dank für die schnellen Antworten!</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358584</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358584</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:38:59 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:46:59 GMT]]></title><description><![CDATA[<p>Ich denke:</p>
<pre><code>std::cin.ignore(256,'\n');   // ignore until new line
</code></pre>
<p>Wobei 256 natürlich willkürlich gewählt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358586</guid><dc:creator><![CDATA[phanzy]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:46:59 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 14:49:56 GMT]]></title><description><![CDATA[<p>HarteWare schrieb:</p>
<blockquote>
<p>std::cin.ignore( &lt;was muss denn hier rein?&gt;, '\n'); &lt;- so gemeint?</p>
</blockquote>
<p>Ja, so ist das gemeint. Als Wert für wie viele Zeichen übersprungen werden sollen, <em>könntest</em> du eine sehr große Zahl nehmen, aber es gibt noch einen Sonderwert, nämlich das Maximum des Typen <code>streamsize</code> . Das heißt dann &quot;unendlich&quot;. Das Maximum kannst du aus dem limits-Header erfahren:</p>
<pre><code>std::cin.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
</code></pre>
<p>Ja, ist ein bisschen umständlich zu schreiben :p . Glücklicherweise braucht man das nicht so oft. Oder wenn doch, dann definiert man sich eben eine Konstante als Kurzschreibweise.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358588</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358588</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Oct 2013 14:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 15:04:26 GMT]]></title><description><![CDATA[<p>Oder man schreibt sich direkt eine kleine Helferfunktion:</p>
<pre><code>istream&amp; ignore_until( istream&amp; is, char ch = '\n' )
{
    return is.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), ch );
}
</code></pre>
<p>(ungetestet)</p>
<p>Übrigens, was soll denn diese Abbruchbedingung:</p>
<pre><code>while( file.is_open() )
</code></pre>
<p>Da schaudert es mir.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /></p>
<pre><code>std::string line;
    while( std::getline(file,line) )
    {
        temp_lines.push_back( std::move(line) ); // move ist optional
        file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );    
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2358596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358596</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Mon, 07 Oct 2013 15:04:26 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 16:27:47 GMT]]></title><description><![CDATA[<p>Huhu,</p>
<p>Dankesehr, funktioniert einwandfrei. Irgendwas mit numeric_limits hatte ich noch im Kopf, schonmal in anderen Threads gelesen.</p>
<p>In dem Fall wäre die Sache so weit geklärt. Man lernt nie aus...</p>
<p>mfg<br />
HarteWare</p>
<p>EDIT: Ein Problem hätte ich noch:</p>
<p>Zeile beginnt mit string</p>
<p>a<br />
a<br />
b<br />
a<br />
b<br />
a<br />
a<br />
etc. (kein festes Muster)</p>
<p>ich will nur Zeilen haben mit Anfangsstring a. Die anderen ist nicht wichtig.</p>
<p>Nun habe ich Sachen versucht wie</p>
<pre><code>Nur wenn: string[4] == &quot;char, welchen nur string a an fünfter Stelle hat&quot;
Dann: schreib in die Datei
</code></pre>
<p>Jedoch klappt es nicht. Es werden weiterhin alle strings aus dem vector in die Datei geschrieben... Wie würde man korrekter Weise sowas angehen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358615</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358615</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 07 Oct 2013 16:27:47 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 16:35:25 GMT]]></title><description><![CDATA[<p>Dann liest du auch nur die Zeilen ein, die du haben willst:</p>
<pre><code>while (std::getline(file, line))
{
    if (line[0] == 'a')
        lines.push_back(std::move(line));
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2358637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358637</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 07 Oct 2013 16:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 16:58:03 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>Dann liest du auch nur die Zeilen ein, die du haben willst:</p>
<pre><code>while (std::getline(file, line))
{
    if (line[0] == 'a')
        lines.push_back(std::move(line));
}
</code></pre>
</blockquote>
<pre><code>std::string line;
while( std::getline( file, line ))
{
    if( line[4] == 'n' )
        temp_lines.push_back( line );
    file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );
}
</code></pre>
<p>wobei gewollter &quot;Startstring Teil&quot; (ST) -&gt; &quot;Login&quot; und ungewollter ST -&gt; &quot;Log Out&quot;</p>
<p>Der vector bleibt leider leer, das war auch mein Ansatz (sowohl beim Schreiben probiert, als auch beim Lesen)...</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358653</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 07 Oct 2013 16:58:03 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 17:02:50 GMT]]></title><description><![CDATA[<p>HarteWare schrieb:</p>
<blockquote>
<p>Der vector bleibt leider leer[..]</p>
</blockquote>
<p>Klar, Du ignorierst ja auch nicht die Zeile, die Du geprüft hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358655</guid><dc:creator><![CDATA[Caligulaminus]]></dc:creator><pubDate>Mon, 07 Oct 2013 17:02:50 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 17:15:00 GMT]]></title><description><![CDATA[<p>Bitte schreib nicht so etwas:</p>
<pre><code>std::getline( file, line )
 if( line[4] == 'n' )
   // ...
</code></pre>
<p>Das schreit ja geradezu nach Ärger. Besser:</p>
<pre><code>std::getline( file, line )
 if( line.length() &gt; 4 &amp;&amp; line[4] == 'n' )
   // ...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2358660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358660</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Oct 2013 17:15:00 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 17:32:26 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Das schreit ja geradezu nach Ärger. Besser:</p>
<pre><code>std::getline( file, line )
 if( line.length() &gt; 4 &amp;&amp; line[4] == 'n' )
   // ...
</code></pre>
</blockquote>
<p>Das ist auch nicht richtig, wenn der Stream in einem Fehlerstatus ist.</p>
<p><a href="http://ideone.com/i0d1P6" rel="nofollow">http://ideone.com/i0d1P6</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358672</guid><dc:creator><![CDATA[Schreihals]]></dc:creator><pubDate>Mon, 07 Oct 2013 17:32:26 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Mon, 07 Oct 2013 18:02:19 GMT]]></title><description><![CDATA[<p>Schreihals schrieb:</p>
<blockquote>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Das schreit ja geradezu nach Ärger. Besser:</p>
<pre><code>std::getline( file, line )
 if( line.length() &gt; 4 &amp;&amp; line[4] == 'n' )
   // ...
</code></pre>
</blockquote>
<p>Das ist auch nicht richtig, wenn der Stream in einem Fehlerstatus ist.</p>
<p><a href="http://ideone.com/i0d1P6" rel="nofollow">http://ideone.com/i0d1P6</a></p>
</blockquote>
<p>Das ist nur als ungefähre Richtungsangabe zu verstehen, ich wollte jetzt nicht noch eine weitere Ebene an Abfragen hinzu fügen. Aber guter Hinweis an Leute, die das Beispiel zu wörtlich genommen hätten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358681</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Oct 2013 18:02:19 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Tue, 08 Oct 2013 18:56:08 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Caligulaminus schrieb:</p>
<blockquote>
<p>HarteWare schrieb:</p>
<blockquote>
<p>Der vector bleibt leider leer[..]</p>
</blockquote>
<p>Klar, Du ignorierst ja auch nicht die Zeile, die Du geprüft hast.</p>
</blockquote>
<p>Wie ist das zu verstehen? So? Denke ich hab das so falsch verstanden...</p>
<pre><code>std::string line;
    while( std::getline(file,line) )
    {
        if( line.length() &gt; 4 &amp;&amp; line[4] == 'n')
        {
            temp_lines.push_back( line ); // move ist optional
            file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );
        }
        file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );
    }
</code></pre>
<p>Stimmt, das Programm ist relativ gesehen recht unzuverlässlich und auch nicht wirklich universell verwendbar, aber ich möchte es nur für eine ganz bestimmte Aufgabe. Aber Danke für die Hinweise, nichts spricht dagegen sauber zu arbeiten.</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2358986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2358986</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Tue, 08 Oct 2013 18:56:08 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Tue, 08 Oct 2013 20:41:14 GMT]]></title><description><![CDATA[<p>Der stream hat einen Marker für die aktuelle Leseposition.<br />
Bei <code>getline(..., '\n')</code> wird der Marker auf die nächste Zeile gesetzt (und der Inhalt zwischen der vorherigen Position und der aktuellen in einen String gespeichert).<br />
Bei <code>ignore(..., '\n')</code> wird der Marker (nur) auf die nächste Zeile gesetzt.</p>
<p>Gegeben sei folgender Dateiinhalt:</p>
<pre><code>0123m
0123n
0123o
</code></pre>
<p>Wo steht der Lesemarker nach dem ersten Schleifendurchlauf? Welchen Inhalt hat line?<br />
Wie sieht es nach dem zweiten Durchlauf aus?</p>
<pre><code class="language-cpp">std::string line;
    while( std::getline(file,line) )
    {
        if( line.length() &gt; 4 &amp;&amp; line[4] == 'n')
        {
            temp_lines.push_back( line ); // move ist optional
            file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );
        }
        file.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' );
    }
</code></pre>
<p>Fällt Dir was auf?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359003</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Tue, 08 Oct 2013 20:41:14 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Wed, 09 Oct 2013 01:25:08 GMT]]></title><description><![CDATA[<p>std::string mystring;<br />
mystring = &quot;blablabla&quot;</p>
<p>if(mystring[3] == 'a')<br />
writeToFile(mystring);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359013</guid><dc:creator><![CDATA[Namenloser324]]></dc:creator><pubDate>Wed, 09 Oct 2013 01:25:08 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Wed, 09 Oct 2013 01:25:55 GMT]]></title><description><![CDATA[<p>Namenloser324 schrieb:</p>
<blockquote>
<p>std::string mystring;<br />
mystring = &quot;blablabla&quot;</p>
<p>if(mystring[3] == 'a')<br />
writeToFile(mystring);</p>
</blockquote>
<p>oh lol hab die zweite Seite nicht gesehen haha einfach ignorieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359014</guid><dc:creator><![CDATA[Namenloser324]]></dc:creator><pubDate>Wed, 09 Oct 2013 01:25:55 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Wed, 09 Oct 2013 13:05:29 GMT]]></title><description><![CDATA[<p>Furble Wurble schrieb:</p>
<blockquote>
<p>Gegeben sei folgender Dateiinhalt:</p>
<pre><code>0123m
0123n
0123o
</code></pre>
<p>Wo steht der Lesemarker nach dem ersten Schleifendurchlauf? Welchen Inhalt hat line?<br />
Wie sieht es nach dem zweiten Durchlauf aus?</p>
<p>Fällt Dir was auf?</p>
</blockquote>
<p>Hallo,</p>
<p>Also als erstes fällt mir auf, dass dieser Thread theoretisch nach Natans Post schon hätte gelöst sein sollen, jedoch ist dem in der Praxis nicht so... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
Na gut:<br />
Nach dem ersten Durchlauf:</p>
<pre><code>0123m
0123n 
0123o &lt;- Lesemarker
Inhalt: &quot;0123m&quot;
</code></pre>
<p>Nach dem Zweiten:<br />
nada, std::getline wird fehlschlagen</p>
<pre><code>while( getline( file, line )) // Diese Zeile schlägt fehl. Habs getestet. 

//======================================
while( std::getline( file, line ))
{
    std::cout &lt;&lt; line &lt;&lt; '\n';
}
</code></pre>
<p>Output:</p>
<pre><code>Press &lt;RETURN&gt; to close this window...
</code></pre>
<p>Ich finds echt toll, das so durchhaltend versucht wird mir zu helfen</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359135</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Wed, 09 Oct 2013 13:05:29 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Wed, 09 Oct 2013 13:26:43 GMT]]></title><description><![CDATA[<p>HarteWare schrieb:</p>
<blockquote>
<p>Also als erstes fällt mir auf, dass dieser Thread theoretisch nach Natans Post schon hätte gelöst sein sollen, jedoch ist dem in der Praxis nicht so... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
Na gut:<br />
Nach dem ersten Durchlauf:</p>
<pre><code>0123m
0123n 
0123o &lt;- Lesemarker
Inhalt: &quot;0123m&quot;
</code></pre>
<p>Nach dem Zweiten:<br />
nada, std::getline wird fehlschlagen</p>
</blockquote>
<p>Sicher?<br />
Hast Du's mal ausprobiert?</p>
<p>HarteWare schrieb:</p>
<blockquote>
<pre><code>while( getline( file, line )) // Diese Zeile schlägt fehl. Habs getestet. 

//======================================
while( std::getline( file, line ))
{
    std::cout &lt;&lt; line &lt;&lt; '\n';
}
</code></pre>
<p>Output:</p>
<pre><code>Press &lt;RETURN&gt; to close this window...
</code></pre>
</blockquote>
<p>Das sollte eigentlich jede Zeile eines Files ausgeben.<br />
Wenn Du jetzt noch die gesuchten Zeilen in einen Vektor einfügst ist die Aufgabe doch gelöst?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359150</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Wed, 09 Oct 2013 13:26:43 GMT</pubDate></item><item><title><![CDATA[Reply to .txt Datei - Jede zweite Zeile &amp;quot;auslassen&amp;quot; on Wed, 09 Oct 2013 13:55:38 GMT]]></title><description><![CDATA[<p>oh man... kann es sein, dass es ihm net passt, wenn vor jeder Zeile im Dokument noch en bissle whitespace ist? Naja das Einlesen hat sich nun geklärt...</p>
<p>Ich möcht mich nochmals bei allen Helfenden bedanken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359163</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359163</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Wed, 09 Oct 2013 13:55:38 GMT</pubDate></item></channel></rss>