<?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[strcat mit mehreren Nullchars]]></title><description><![CDATA[<p>Hallo,<br />
für eine (WinAPI) Funktion benötige ich einen String der sich aus 2 Strings mit abschließendem Nullchar aufbaut (d.h.: Text, Nullchar, Text, Nullchar, Nullchar). Die beiden Teilstrings sollten nacheinander gestellt werden, wie hier im String &quot;neu&quot; dargestellt:</p>
<pre><code class="language-cpp">teil1 = &quot;Teil1&quot;;
teil2 = &quot;Teil2&quot;;

neu = &quot;Teil1\0Teil2\0&quot;;
</code></pre>
<p>Wie kann ich nun den String &quot;neu&quot; aus den beiden Teilstrings erstellen?<br />
Mit strcat() geht es ja nicht, da strcat annimnt, ein String sei zu Ende bei \0..</p>
<p>MfG,<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/206995/strcat-mit-mehreren-nullchars</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 21:06:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206995.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 02 Mar 2008 17:04:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to strcat mit mehreren Nullchars on Sun, 02 Mar 2008 17:04:26 GMT]]></title><description><![CDATA[<p>Hallo,<br />
für eine (WinAPI) Funktion benötige ich einen String der sich aus 2 Strings mit abschließendem Nullchar aufbaut (d.h.: Text, Nullchar, Text, Nullchar, Nullchar). Die beiden Teilstrings sollten nacheinander gestellt werden, wie hier im String &quot;neu&quot; dargestellt:</p>
<pre><code class="language-cpp">teil1 = &quot;Teil1&quot;;
teil2 = &quot;Teil2&quot;;

neu = &quot;Teil1\0Teil2\0&quot;;
</code></pre>
<p>Wie kann ich nun den String &quot;neu&quot; aus den beiden Teilstrings erstellen?<br />
Mit strcat() geht es ja nicht, da strcat annimnt, ein String sei zu Ende bei \0..</p>
<p>MfG,<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466772</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466772</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Sun, 02 Mar 2008 17:04:26 GMT</pubDate></item><item><title><![CDATA[Reply to strcat mit mehreren Nullchars on Sun, 02 Mar 2008 17:20:39 GMT]]></title><description><![CDATA[<p>du könntest <code>std::string</code> s verwenden und dann per c_str einen <code>const char*</code> an deine funktion übergeben:</p>
<pre><code class="language-cpp">std::string foo(&quot;Test&quot;);
foo += '\0';
foo += &quot;Test&quot;;
foo += '\0';

//oder:
const char* bar = &quot;Test\0Test&quot;;
string baz(bar, bar+10);

//verwende:
cout &lt;&lt; baz &lt;&lt; endl;
cout &lt;&lt; baz.c_str() &lt;&lt; endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1466775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466775</guid><dc:creator><![CDATA[queer_boy]]></dc:creator><pubDate>Sun, 02 Mar 2008 17:20:39 GMT</pubDate></item><item><title><![CDATA[Reply to strcat mit mehreren Nullchars on Sun, 02 Mar 2008 18:24:36 GMT]]></title><description><![CDATA[<p>memcpy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466808</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466808</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Sun, 02 Mar 2008 18:24:36 GMT</pubDate></item><item><title><![CDATA[Reply to strcat mit mehreren Nullchars on Sun, 02 Mar 2008 18:26:30 GMT]]></title><description><![CDATA[<p>strcpy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466810</guid><dc:creator><![CDATA[trzu]]></dc:creator><pubDate>Sun, 02 Mar 2008 18:26:30 GMT</pubDate></item><item><title><![CDATA[Reply to strcat mit mehreren Nullchars on Sun, 02 Mar 2008 18:56:16 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe jetzt memcpy verwendet.<br />
Man nimmt am besten eine size_t variable, in der man mitzählt, wie lang der string ist (weil ja strlen nicht mehr funktioniert..), und kopiert dann an die stelle &quot;&amp;stringname[szPosition]&quot; die neuen Daten hin.</p>
<p>Danke für alle Antworten!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1466839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1466839</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Sun, 02 Mar 2008 18:56:16 GMT</pubDate></item></channel></rss>