<?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[0 ans ende von einem string]]></title><description><![CDATA[<p>hallo!<br />
ich möchte hinter das letzte element eines C++ string eine abschließende null explizit setzten. Wie macht man das?</p>
<pre><code class="language-cpp">string c;
c = einzelnercharohnenull;
[hier kommt eine funktion die eine 0 am schluss erwartet]
</code></pre>
<p>wie man sieht weiße ich einen buchstaben z.b. 'a' ohne null hinten drann zu.<br />
Also muss ich die selber drann setzten. kann ich einfach schreiben c[2] = '\0';?<br />
danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/225775/0-ans-ende-von-einem-string</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 08:42:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/225775.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 Oct 2008 19:54:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 0 ans ende von einem string on Fri, 24 Oct 2008 19:54:46 GMT]]></title><description><![CDATA[<p>hallo!<br />
ich möchte hinter das letzte element eines C++ string eine abschließende null explizit setzten. Wie macht man das?</p>
<pre><code class="language-cpp">string c;
c = einzelnercharohnenull;
[hier kommt eine funktion die eine 0 am schluss erwartet]
</code></pre>
<p>wie man sieht weiße ich einen buchstaben z.b. 'a' ohne null hinten drann zu.<br />
Also muss ich die selber drann setzten. kann ich einfach schreiben c[2] = '\0';?<br />
danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1604386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1604386</guid><dc:creator><![CDATA[stringuser5]]></dc:creator><pubDate>Fri, 24 Oct 2008 19:54:46 GMT</pubDate></item><item><title><![CDATA[Reply to 0 ans ende von einem string on Fri, 24 Oct 2008 20:20:06 GMT]]></title><description><![CDATA[<p><code>std::string</code> braucht zum einen keine <code>'\0'</code> , allerdings kann man von <code>std::string</code> ein null terminierter <code>char const*</code> bekommen.</p>
<pre><code class="language-cpp">std::string c;
c.c_str();
</code></pre>
<p>Referenz: <a href="http://www.cplusplus.com/reference/string/string/c_str.html" rel="nofollow">http://www.cplusplus.com/reference/string/string/c_str.html</a></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1604393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1604393</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Fri, 24 Oct 2008 20:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to 0 ans ende von einem string on Fri, 24 Oct 2008 20:35:27 GMT]]></title><description><![CDATA[<p>stringuser5 schrieb:</p>
<blockquote>
<p>hallo!<br />
ich möchte hinter das letzte element eines C++ string eine abschließende null explizit setzten. Wie macht man das?</p>
</blockquote>
<p>Ich kenne jetzt keine STL-Umsetzung wo dies nicht ohnehin schon beim std::string gegeben ist, auch wenn es wohl durchaus eine legale Umsetzung wäre.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1604398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1604398</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Fri, 24 Oct 2008 20:35:27 GMT</pubDate></item></channel></rss>