<?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[strings zusammenfügen]]></title><description><![CDATA[<p>Was fehlt, damit sowas funktioniert.</p>
<pre><code class="language-cpp">const char* feld[] = { &quot;feld1&quot;, &quot;feld2&quot;, &quot;feldN&quot;, (char*)0 };
vector&lt;string&gt; ergebnis;
string s;

s.push_back( *feld++ );
// hier kommen noch ein paar mal push_back

ergebnis.push_back( s );
</code></pre>
<p>und das funktioniert gar nicht - obwohl ich nicht nachvollziehen kann wieso.</p>
<p>*feld sollte von Typ const char* sein, was mit push_back gehen sollte.</p>
<p>Was fehlt da?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/258561/strings-zusammenfügen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 09:52:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/258561.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Jan 2010 09:47:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 09:47:06 GMT]]></title><description><![CDATA[<p>Was fehlt, damit sowas funktioniert.</p>
<pre><code class="language-cpp">const char* feld[] = { &quot;feld1&quot;, &quot;feld2&quot;, &quot;feldN&quot;, (char*)0 };
vector&lt;string&gt; ergebnis;
string s;

s.push_back( *feld++ );
// hier kommen noch ein paar mal push_back

ergebnis.push_back( s );
</code></pre>
<p>und das funktioniert gar nicht - obwohl ich nicht nachvollziehen kann wieso.</p>
<p>*feld sollte von Typ const char* sein, was mit push_back gehen sollte.</p>
<p>Was fehlt da?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837368</guid><dc:creator><![CDATA[Feld]]></dc:creator><pubDate>Tue, 12 Jan 2010 09:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 10:14:59 GMT]]></title><description><![CDATA[<p>Was da fehlt? Die Fehlermeldung...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837385</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:14:59 GMT</pubDate></item><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 10:20:18 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/string/string/push_back/" rel="nofollow">http://www.cplusplus.com/reference/string/string/push_back/</a></p>
<p>Also ich sehe da nur char als mögliches Argument, nicht char*.</p>
<p>einfache Abhilfe: Stringstream</p>
<pre><code class="language-cpp">stringstream s;
s &lt;&lt; dein_erster_nullterminierten_char_zeiger;
s &lt;&lt; dein_zweiter_nullterminierten_char_zeiger;
// ...
ergebnis.push_back( s.str() );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1837390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837390</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:20:18 GMT</pubDate></item><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 10:30:52 GMT]]></title><description><![CDATA[<p>Einfacher ist natürlich einfach den += operator zu verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837401</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837401</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 10:34:54 GMT]]></title><description><![CDATA[<p>Fellhuhn schrieb:</p>
<blockquote>
<p>Einfacher ist natürlich einfach den += operator zu verwenden.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> Manchmal denke ich zu kompliziert. Es gab in letzter Zeit einfach zu viele Threads in denen nach der Addition von ints und Cstrings gefragt wurde, da war der Stringstream immer die passende Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837403</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837403</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:34:54 GMT</pubDate></item><item><title><![CDATA[Reply to strings zusammenfügen on Tue, 12 Jan 2010 10:54:20 GMT]]></title><description><![CDATA[<p>Je nachdem was er wirklich machen will ist ein stringstream sicher auch keine schlechte Wahl. Vor allem von dessen Existenz zu wissen kann einem viel Arbeit ersparen. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1837416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837416</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:54:20 GMT</pubDate></item></channel></rss>