<?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[File einlesen - Sonderaktionen]]></title><description><![CDATA[<p>Hallo!</p>
<p>ich habe folgendes Problem.<br />
Und zwar lese ich ein File über den Konsolenparameter ein. Nun möchte ich in diesem File alle Kommentare und alle leere Zeilen löschen.</p>
<p>Beispiel:</p>
<p>bla bla bla<br />
%kommentar</p>
<p>%kommentar<br />
blubb blubb blubb<br />
bli bli bli</p>
<p>Sollte zu folgendem String werden:</p>
<p>bla bla bla<br />
blubb blubb blubb<br />
bli bli bli</p>
<p>Man kann auch alles zusammenpferchen, würde auch funktionieren also:</p>
<p>bla bla bla blubb blubb blubb bli bli bli</p>
<p>Ganz wichtig: Auch leer zeilen am Ende löschen.</p>
<p>Hoffe mir kann jemand helfen <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="😉"
    /></p>
<p>lg<br />
Killver</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/215491/file-einlesen-sonderaktionen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 06:54:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/215491.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Jun 2008 18:03:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 18:03:30 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>ich habe folgendes Problem.<br />
Und zwar lese ich ein File über den Konsolenparameter ein. Nun möchte ich in diesem File alle Kommentare und alle leere Zeilen löschen.</p>
<p>Beispiel:</p>
<p>bla bla bla<br />
%kommentar</p>
<p>%kommentar<br />
blubb blubb blubb<br />
bli bli bli</p>
<p>Sollte zu folgendem String werden:</p>
<p>bla bla bla<br />
blubb blubb blubb<br />
bli bli bli</p>
<p>Man kann auch alles zusammenpferchen, würde auch funktionieren also:</p>
<p>bla bla bla blubb blubb blubb bli bli bli</p>
<p>Ganz wichtig: Auch leer zeilen am Ende löschen.</p>
<p>Hoffe mir kann jemand helfen <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="😉"
    /></p>
<p>lg<br />
Killver</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527223</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527223</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Wed, 11 Jun 2008 18:03:30 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 19:16:03 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>einfache Version ohne Fehlerprüfung</p>
<pre><code class="language-cpp">fstream in(argv[1]);
	string erg;
	if(in)
	{
		for(string ReadLine; getline(in, ReadLine);)
		{
			if(ReadLine.empty() == false &amp;&amp; ReadLine[0] != '%')
				erg += ReadLine;
		}
		cout &lt;&lt; erg &lt;&lt; &quot;Ergebnis:&quot; &lt;&lt; endl;
		in.close();
	}
</code></pre>
<p>Wobei die Leerzeilen wirkliche leerzeilen sein müssen und das Kommentarzeichen am Anfang stehen muss.</p>
<p>Gruß<br />
Tobi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527259</guid><dc:creator><![CDATA[Tobias Gerg]]></dc:creator><pubDate>Wed, 11 Jun 2008 19:16:03 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 20:01:06 GMT]]></title><description><![CDATA[<p>Die Kommentare können auch innerhalb von zeilen stehen.</p>
<p>also</p>
<p>blaaaaaaa %kommentar</p>
<p>Wie kamma des lösen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527282</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Wed, 11 Jun 2008 20:01:06 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 20:15:42 GMT]]></title><description><![CDATA[<p>Du musst den string parsen... mit find und substr von std::string sollte das kein Problem sein.</p>
<p>:schland:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527289</guid><dc:creator><![CDATA[Tobias Gerg]]></dc:creator><pubDate>Wed, 11 Jun 2008 20:15:42 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 20:21:32 GMT]]></title><description><![CDATA[<p>Ich plage mich seitner Ewigkeit damit herum, kann mir da wer den Code schreiben, müsstjanet viel sein.</p>
<p>Danke abermal für die Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527294</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Wed, 11 Jun 2008 20:21:32 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Wed, 11 Jun 2008 20:26:13 GMT]]></title><description><![CDATA[<p>Ich bin mal so frei...</p>
<pre><code class="language-cpp">fstream in(argv[1]);
	string erg;
	int find = std::string::npos;
	if(in)
	{
		for(string ReadLine; getline(in, ReadLine);)
		{
			if(ReadLine.empty() == false)
				if((find = ReadLine.find('%')) != std::string::npos)
					erg += ReadLine.substr(0, find);
				else 
					erg += ReadLine;
		}
		cout &lt;&lt; erg &lt;&lt; &quot;Ergebnis:&quot; &lt;&lt; endl;
		in.close();
	}
</code></pre>
<p>find findet den Kommentar und substr schneidet bis zum Kommentar aus...</p>
<p>Gruß<br />
Tobi</p>
<p>:schland:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527296</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527296</guid><dc:creator><![CDATA[Tobias Gerg]]></dc:creator><pubDate>Wed, 11 Jun 2008 20:26:13 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Thu, 12 Jun 2008 08:40:55 GMT]]></title><description><![CDATA[<p>Also das mim Kommentare löschen funktioniert super. Leider funktioniert das leere Zeilen löschen net, die hat er immer noch!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527470</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527470</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Thu, 12 Jun 2008 08:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Thu, 12 Jun 2008 08:53:54 GMT]]></title><description><![CDATA[<p>Tja, die leeren Zeilen werden auch nur gelöscht, wenn sie wirklich leer sind. Dass heißt dass keine Leerzeichen vorhanden sind...</p>
<p>Gruß<br />
Tobi</p>
<p>:schland:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527488</guid><dc:creator><![CDATA[Tobias Gerg]]></dc:creator><pubDate>Thu, 12 Jun 2008 08:53:54 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Thu, 12 Jun 2008 08:58:02 GMT]]></title><description><![CDATA[<p>Es sind keine Leerzeichen enthalten.</p>
<p>Habs nun folgendermaßen erweitert:</p>
<pre><code class="language-cpp">if(ReadLine.empty() == false &amp;&amp; ReadLine.find_first_not_of(&quot; \t\v\r\n&quot;) != std::string::npos)
</code></pre>
<p>Nun löscht er die Leerzeilen, nur wenn am Ende mehrere Leerzeilen sind, löscht er nur eine.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527494</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Thu, 12 Jun 2008 08:58:02 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Thu, 12 Jun 2008 09:00:42 GMT]]></title><description><![CDATA[<p>Also er löscht zwar nun die Leerzeilen zwischendurch im Text, aber nicht die Leerzeile am Ende.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527498</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527498</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Thu, 12 Jun 2008 09:00:42 GMT</pubDate></item><item><title><![CDATA[Reply to File einlesen - Sonderaktionen on Thu, 12 Jun 2008 09:11:02 GMT]]></title><description><![CDATA[<p>Hab das Problem jetzt anderswärtig gelöst, indem ich einfach im späteren programmverlauf aufnen leeren string beinem curr_token abfrage.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1527506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1527506</guid><dc:creator><![CDATA[Killver]]></dc:creator><pubDate>Thu, 12 Jun 2008 09:11:02 GMT</pubDate></item></channel></rss>