<?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 laden, in txt strings ersetzen, txt wieder abspeichern]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte z.B. in einer txt-Datei alle Strings die ein &quot;<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">test</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.61508em;"></span><span class="strut bottom" style="height:0.61508em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit">s</span><span class="mord mathit">t</span></span></span></span>&quot; enthalten durch ein &quot;Hallo&quot; ersetzen.</p>
<p>Bisher klappt das auch sehr gut, aber ich wollte mal fragen ob es auch eleganter geht.</p>
<p>Mein bisheriger Ansatz:<br />
1. txt in einen ifstream laden.<br />
2. daten vom ifstream in einen stringstream schieben (stream &lt;&lt; ifstream.rdbuf(); )<br />
3. inhalt mit einer schleife und replace durchsuchen und ersetzen<br />
4. neuen string in einen ofstream schieben und in datei schreiben.</p>
<p>Mir würde es gefallen wenn ich den 2. Schritt irgendwie weglassen könnte, weiß aber da keinen genaueren ansatz drin.</p>
<p>Hat jemand eine Idee? Danke im Voraus! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122676/txt-laden-in-txt-strings-ersetzen-txt-wieder-abspeichern</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 07:17:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122676.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 08 Oct 2005 13:45:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to txt laden, in txt strings ersetzen, txt wieder abspeichern on Sat, 08 Oct 2005 13:45:24 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte z.B. in einer txt-Datei alle Strings die ein &quot;<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">test</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.61508em;"></span><span class="strut bottom" style="height:0.61508em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit">s</span><span class="mord mathit">t</span></span></span></span>&quot; enthalten durch ein &quot;Hallo&quot; ersetzen.</p>
<p>Bisher klappt das auch sehr gut, aber ich wollte mal fragen ob es auch eleganter geht.</p>
<p>Mein bisheriger Ansatz:<br />
1. txt in einen ifstream laden.<br />
2. daten vom ifstream in einen stringstream schieben (stream &lt;&lt; ifstream.rdbuf(); )<br />
3. inhalt mit einer schleife und replace durchsuchen und ersetzen<br />
4. neuen string in einen ofstream schieben und in datei schreiben.</p>
<p>Mir würde es gefallen wenn ich den 2. Schritt irgendwie weglassen könnte, weiß aber da keinen genaueren ansatz drin.</p>
<p>Hat jemand eine Idee? Danke im Voraus! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/887748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/887748</guid><dc:creator><![CDATA[STL user]]></dc:creator><pubDate>Sat, 08 Oct 2005 13:45:24 GMT</pubDate></item><item><title><![CDATA[Reply to txt laden, in txt strings ersetzen, txt wieder abspeichern on Sat, 08 Oct 2005 15:14:40 GMT]]></title><description><![CDATA[<p>zeile aus ifstream laden<br />
ggf. <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">test</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.61508em;"></span><span class="strut bottom" style="height:0.61508em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit">s</span><span class="mord mathit">t</span></span></span></span> ersetzen<br />
zeile in ofstream schreiben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/887804</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/887804</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Sat, 08 Oct 2005 15:14:40 GMT</pubDate></item></channel></rss>