<?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 felder in ein char feld]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich möchte gerne mehrere char felder in ein char feld speichern.<br />
Also in etwa so.</p>
<p>char feld[100];<br />
char a[3],b[4],c[4],d[9]...</p>
<p>also die Felder a,b,c,d in das feld[100] speichern.</p>
<p>Wie ist sowas möglich...</p>
<p>Vielen Dank für eure Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275451/char-felder-in-ein-char-feld</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 01:06:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275451.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Oct 2010 19:00:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to char felder in ein char feld on Thu, 14 Oct 2010 19:00:33 GMT]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich möchte gerne mehrere char felder in ein char feld speichern.<br />
Also in etwa so.</p>
<p>char feld[100];<br />
char a[3],b[4],c[4],d[9]...</p>
<p>also die Felder a,b,c,d in das feld[100] speichern.</p>
<p>Wie ist sowas möglich...</p>
<p>Vielen Dank für eure Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1965740</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965740</guid><dc:creator><![CDATA[bordon]]></dc:creator><pubDate>Thu, 14 Oct 2010 19:00:33 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Thu, 14 Oct 2010 19:03:25 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/algorithm/copy/" rel="nofollow">http://www.cplusplus.com/reference/algorithm/copy/</a><br />
Und der Rest ist ein bisschen Bastelarbeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1965745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965745</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 14 Oct 2010 19:03:25 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Thu, 14 Oct 2010 19:05:32 GMT]]></title><description><![CDATA[<p>klingt ziemlich kompliziert, gibt es nichts einfacheres dazu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1965748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965748</guid><dc:creator><![CDATA[bordon]]></dc:creator><pubDate>Thu, 14 Oct 2010 19:05:32 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Thu, 14 Oct 2010 19:26:38 GMT]]></title><description><![CDATA[<p>bordon schrieb:</p>
<blockquote>
<p>klingt ziemlich kompliziert, gibt es nichts einfacheres dazu?</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="😮"
    /> Kompliziert? Lass dich nicht von der Templatedefinition abschrecken. Einfacher wird's kaum gehen.<br />
Ich erkläre mal auf Deutsch:</p>
<pre><code class="language-cpp">copy(erstes_element, element_hinter_letztem_element, wohin_kopiert_werden_soll);
</code></pre>
<p>Damit kannst du zum Beispiel das hier machen:</p>
<pre><code class="language-cpp">char feld[100];
char a[3],b[4];

copy(a, a+3, feld);  // von a bis a+3 nach feld kopieren. feld[0] ist dann a[0], feld[1] ist a[1] und feld[2] ist a[2]
copy(b, b+4, feld + 3) // feld[3] ist dann b[0], feld[4] ist b[1], usw.
</code></pre>
<p>Wie du das dann hinbekommst, immer an die richtige Stelle zu kopieren, überlasse ich dir.</p>
<p>Du kannst natürlich alles von Hand über Schleifen kopieren, wenn dir das lieber ist... <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>
<p>Oder du könntest auch einen leeren String erstellen und immer mittels append anhängen. Das wäre eine sehr einfache Möglichkeit, alle kleinen Felder zusammenzukleben. Und hinterher kopierst du das Ergebnis nach feld.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1965757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965757</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 14 Oct 2010 19:26:38 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Thu, 14 Oct 2010 20:52:37 GMT]]></title><description><![CDATA[<p>Vielleicht könntest du das auch mit einer union machen. Dann hast du nur ein Feld und die Änderungen, die du an den einzelnen Feldern a,b,c,... machst, wirken sich dann auch gleich auf das große Feld aus.</p>
<p>MfG, Jochen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1965790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965790</guid><dc:creator><![CDATA[Jochen S.]]></dc:creator><pubDate>Thu, 14 Oct 2010 20:52:37 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Fri, 15 Oct 2010 08:51:16 GMT]]></title><description><![CDATA[<p>bordon schrieb:</p>
<blockquote>
<p>Hallo zusammen,<br />
ich möchte gerne mehrere char felder in ein char feld speichern.<br />
Also in etwa so.</p>
<p>char feld[100];<br />
char a[3],b[4],c[4],d[9]...</p>
<p>also die Felder a,b,c,d in das feld[100] speichern.</p>
</blockquote>
<p>Du kannst aus a,b,c,d Zeiger machen, die irgendwo in das feld zeigen.</p>
<pre><code class="language-cpp">int main()
{
  const int buffsize = 100;
  char buffer[buffsize];
  char* a = buffer+0;
  char* b = buffer+3;
  char* c = buffer+3+4;
  char* d = buffer+3+4+4;
}
</code></pre>
<p>Die Gefahr ist allerdings, dass Du versehentlich zB über den Zeiger a das überschreiben kannst, worauf auch b zeigt:</p>
<pre><code class="language-cpp">a[3] = 'X'; // verändert das erste Zeichen, auf das b zeigt.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1965974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1965974</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Fri, 15 Oct 2010 08:51:16 GMT</pubDate></item><item><title><![CDATA[Reply to char felder in ein char feld on Fri, 15 Oct 2010 11:27:35 GMT]]></title><description><![CDATA[<p>** <code>vector&lt;vector&lt;char*&gt;&gt; foo;</code> **</p>
<p>Dann hast du eine Liste an Listen von char*-pointern.<br />
Element hinzufügen: <code>push_back</code> (element <code>)</code> function<br />
Zugriff: <code>operator[]</code> (also zB <code>foo[2][5]</code> )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966035</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966035</guid><dc:creator><![CDATA[lk]]></dc:creator><pubDate>Fri, 15 Oct 2010 11:27:35 GMT</pubDate></item></channel></rss>