<?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[char Array ohne feste Größe wie?]]></title><description><![CDATA[<p>Hallo Leute,<br />
also ich bin gerade dabei ich grafisches Chat Programm zu erstellen.<br />
So das Problem ist, dass ich ein char Array habe an das immer wieder Text angehängt wird. Aber das Array hat eine feste Größe als ist es irgendwann voll und das Programm stürzt ab.</p>
<p>So jetzt ist meine Frage wie bekomme ich es dass ich ein Array habe wo immer wieder Text hinzugefügt werden kann ohne am Anfang festzulegen wie viel max in das Array passt.</p>
<p>so habe ich es bis jetzt</p>
<pre><code>char TEMP[999];
char neuertext[999]; //ändert sich immer je nachdem was der Nutzer eingibt
while(neuer_text = true)
{
    strcat(TEMP, neuertext); // neuen text anhängen
}
</code></pre>
<p>so wie ein C++ string der ist ja auch unendlich groß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/324243/char-array-ohne-feste-größe-wie</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 14:54:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/324243.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 08 Mar 2014 18:41:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 18:45:11 GMT]]></title><description><![CDATA[<p>Hallo Leute,<br />
also ich bin gerade dabei ich grafisches Chat Programm zu erstellen.<br />
So das Problem ist, dass ich ein char Array habe an das immer wieder Text angehängt wird. Aber das Array hat eine feste Größe als ist es irgendwann voll und das Programm stürzt ab.</p>
<p>So jetzt ist meine Frage wie bekomme ich es dass ich ein Array habe wo immer wieder Text hinzugefügt werden kann ohne am Anfang festzulegen wie viel max in das Array passt.</p>
<p>so habe ich es bis jetzt</p>
<pre><code>char TEMP[999];
char neuertext[999]; //ändert sich immer je nachdem was der Nutzer eingibt
while(neuer_text = true)
{
    strcat(TEMP, neuertext); // neuen text anhängen
}
</code></pre>
<p>so wie ein C++ string der ist ja auch unendlich groß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387705</guid><dc:creator><![CDATA[MaxundTutorials]]></dc:creator><pubDate>Sat, 08 Mar 2014 18:45:11 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 18:49:29 GMT]]></title><description><![CDATA[<p>Du kennst std::string und benutzt es nicht? Warum?<br />
Die Bedingung in deiner while-Schleife macht nicht, was du glaubst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387708</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sat, 08 Mar 2014 18:49:29 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 19:19:13 GMT]]></title><description><![CDATA[<p>Das Problem ist eigentlich alle Funktionen brauchen char.<br />
also musste ich das jedas mal in char convertieren und zurück.</p>
<p>Wenn du mir sagst wie das geht probier ich es mal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387713</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387713</guid><dc:creator><![CDATA[MaxundTutorials]]></dc:creator><pubDate>Sat, 08 Mar 2014 19:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 19:22:35 GMT]]></title><description><![CDATA[<p>MaxundTutorials schrieb:</p>
<blockquote>
<p>Wenn du mir sagst wie das geht probier ich es mal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
</blockquote>
<p>funktion(neuer_text.c_str());</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387714</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sat, 08 Mar 2014 19:22:35 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 19:48:49 GMT]]></title><description><![CDATA[<p>Bzw. seit C++11</p>
<pre><code>funktion(neuer_text.data());
</code></pre>
<p>Das ist allgemeiner.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387719</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 08 Mar 2014 19:48:49 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 19:56:08 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<p>Das ist allgemeiner.</p>
</blockquote>
<p>Was soll denn &quot;allgemeiner&quot; heissen?</p>
<p>Du verzichtest vor C++11 auf die Garantie, dass der String nullterminiert ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387722</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387722</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 08 Mar 2014 19:56:08 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 20:01:44 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Du verzichtest vor C++11 auf die Garantie, dass der String nullterminiert ist.</p>
</blockquote>
<p>... deswegen habe ich ja geschrieben, &quot;seit C++11&quot; (falls du dich auf den zweiten Edit beziehst).</p>
<blockquote>
<p>Was soll denn &quot;allgemeiner&quot; heissen?</p>
</blockquote>
<p>Allgemeiner heißt allgemeiner. Es funktioniert bspw. auch für <code>vector&lt;char&gt;</code> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387726</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387726</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 08 Mar 2014 20:01:44 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 20:07:00 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<p>Allgemeiner heißt allgemeiner. Es funktioniert bspw. auch für <code>vector&lt;char&gt;</code> .</p>
</blockquote>
<p>Wird emorm Spaß machen, ganz einfach nach vector&lt;char&gt; umzustellen und mangels Nullterminierung alles umzuschreiben.<br />
Nö, hier bleibe ich bei c_str, weil ich das meine.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387729</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sat, 08 Mar 2014 20:07:00 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 20:08:48 GMT]]></title><description><![CDATA[<blockquote>
<p>und mangels Nullterminierung alles umzuschreiben.</p>
</blockquote>
<p>Oh... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387730</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 08 Mar 2014 20:08:48 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sat, 08 Mar 2014 20:27:40 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<p>Bzw. seit C++11</p>
<pre><code>funktion(neuer_text.data());
</code></pre>
<p>Das ist allgemeiner.</p>
</blockquote>
<p><code>funktion(&amp;*begin(neuer_text))</code> ist noch allgemeiner.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387736</guid><dc:creator><![CDATA[TyRoXx]]></dc:creator><pubDate>Sat, 08 Mar 2014 20:27:40 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sun, 09 Mar 2014 01:45:42 GMT]]></title><description><![CDATA[<p>TyRoXx schrieb:</p>
<blockquote>
<p>Arcoth schrieb:</p>
<blockquote>
<p>Bzw. seit C++11</p>
<pre><code>funktion(neuer_text.data());
</code></pre>
<p>Das ist allgemeiner.</p>
</blockquote>
<p><code>funktion(&amp;*begin(neuer_text))</code> ist noch allgemeiner.</p>
</blockquote>
<p>Aber auf die Art und Weise, die dich in Probleme bringt. Die data-Methode wird nämlich nur von Containern angeboten, bei denen dies Sinn macht (vector, string, array), wohingegen dieser Vorschlag hier bei allem funktioniert. Das heißt, auch bei nicht-kontinuierlichen Datenstrukturen - ohne jede Warnung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387766</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387766</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 09 Mar 2014 01:45:42 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sun, 09 Mar 2014 11:17:48 GMT]]></title><description><![CDATA[<p>Ich denke, TyRoXx wollte damit vor allem aufzeigen, dass &quot;allgemeiner&quot; hier ein schlechtes Argument ist <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/2387790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387790</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 09 Mar 2014 11:17:48 GMT</pubDate></item><item><title><![CDATA[Reply to char Array ohne feste Größe wie? on Sun, 09 Mar 2014 12:37:16 GMT]]></title><description><![CDATA[<p>Jo Leute,<br />
auf jeden Fall vielen dank mache es jetzt alles mit strings und wandel sie dann mit .c_str() und .str() so um wie ich sie brauche <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2387804</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2387804</guid><dc:creator><![CDATA[MaxundTutorials]]></dc:creator><pubDate>Sun, 09 Mar 2014 12:37:16 GMT</pubDate></item></channel></rss>