<?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[String to Array]]></title><description><![CDATA[<p>Hi,<br />
ich hab ne Frage:<br />
Wie kann ich einen String in ein Array umwandeln?</p>
<pre><code class="language-cpp">string = array
</code></pre>
<p>geht ja,aber wie bekomm ich den String wieder nach array?</p>
<p>Danke im voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/137357/string-to-array</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 19:40:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/137357.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Feb 2006 19:53:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String to Array on Thu, 16 Feb 2006 19:53:08 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich hab ne Frage:<br />
Wie kann ich einen String in ein Array umwandeln?</p>
<pre><code class="language-cpp">string = array
</code></pre>
<p>geht ja,aber wie bekomm ich den String wieder nach array?</p>
<p>Danke im voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996181</guid><dc:creator><![CDATA[Strings]]></dc:creator><pubDate>Thu, 16 Feb 2006 19:53:08 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Thu, 16 Feb 2006 20:01:37 GMT]]></title><description><![CDATA[<p>wenn ich dich richtig verstanden hab, müste es das sein...</p>
<pre><code class="language-cpp">char array[23];
string str = &quot;hello world&quot;;

strcpy(array, str.c_str());
</code></pre>
<p>mfg blan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996186</guid><dc:creator><![CDATA[blan]]></dc:creator><pubDate>Thu, 16 Feb 2006 20:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Thu, 16 Feb 2006 20:02:53 GMT]]></title><description><![CDATA[<p>Strings schrieb:</p>
<blockquote>
<p>Hi,<br />
ich hab ne Frage:<br />
Wie kann ich einen String in ein Array umwandeln?</p>
<pre><code class="language-cpp">string = array
</code></pre>
<p>geht ja,aber wie bekomm ich den String wieder nach array?</p>
<p>Danke im voraus.</p>
</blockquote>
<p>Hallo,<br />
Ich gehe mal davon aus, dass du mit &quot;strings&quot; die Klasse std::string und mit &quot;Arrays&quot; ein char-Array meinst.</p>
<p>Wie du richtig bemerkt hast, kannst du ein char-Array über den Copy-Ctor von std::string in einen std::string konvertieren.</p>
<p>Umgekehrt gehts Folgendermaßen:</p>
<pre><code class="language-cpp">#include &lt;cstring&gt; // für strcpy(), strncpy()

...
char str[11];
string s(&quot;Hallo C++!&quot;);
strcpy(str, s.c_str()); // kopiert s.c_str() nach str

// bzw.
strncpy(str, s.c_str(), 11); // kopiert 10 Zeichen + '\0' von s.c_str() nach str
</code></pre>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996188</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Thu, 16 Feb 2006 20:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Thu, 16 Feb 2006 20:05:08 GMT]]></title><description><![CDATA[<p>Danke <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="🙂"
    /><br />
Dachte das der c_string Privat sei,naja man lernt nie aus <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>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996191</guid><dc:creator><![CDATA[Strings]]></dc:creator><pubDate>Thu, 16 Feb 2006 20:05:08 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Thu, 16 Feb 2006 20:06:11 GMT]]></title><description><![CDATA[<p>Arghh seh grade das das eine Methode ist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/996194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/996194</guid><dc:creator><![CDATA[Edit]]></dc:creator><pubDate>Thu, 16 Feb 2006 20:06:11 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Sun, 19 Feb 2006 18:06:59 GMT]]></title><description><![CDATA[<p>Hallo, um nicht noch einen neuen Thread zu eröffnen will ich hier mein Problem schnell schildern.</p>
<p>Ich möchte gerne ein string-Objekt erstellen. Der Konstruktor bekommt als Parameter eine Zeichenfolge(vorliegend als char*).<br />
Das string Objekt muss dynamisch erstellt werden. (um später in einem Vector gespeichert zu werden)</p>
<p>mein code:</p>
<p>void Klassenname::methode ( char <em>cWort){<br />
string</em> wort = new string( cWort);<br />
printf( &quot; das Wort ursprünglich: %s \n&quot;, cWort) ;<br />
printf( &quot; das Wort als string: %s \n, wort-&gt;c_str);<br />
}</p>
<p>Die gewünschte Ausgabe beim Aufruf mit --methode(&quot;Hallo&quot;);-- ist:</p>
<p>das Wort ursprünglich: Hallo<br />
das Wort als string: Hallo</p>
<p>aber ich bekomme:<br />
das Wort ursprünglich: Hallo<br />
das Wort als string: é Ñ</p>
<p>Ich benutze Visual Studio 7<br />
und importiere &lt;string&gt; &lt;stdio.h&gt;</p>
<p>An was kann dies liegen?</p>
<p>Da ich morgen das Programm abgeben muss, hoffe ich, dass mir einer von euch helfen kann. Ich wäre sehr dankbar!</p>
<p>Gruß Karl</p>
]]></description><link>https://www.c-plusplus.net/forum/post/998069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/998069</guid><dc:creator><![CDATA[k.m.w]]></dc:creator><pubDate>Sun, 19 Feb 2006 18:06:59 GMT</pubDate></item><item><title><![CDATA[Reply to String to Array on Sun, 19 Feb 2006 18:25:59 GMT]]></title><description><![CDATA[<p>*handanstirnhau*</p>
<p>c_str --&gt;c_str(), da es ja eine Methode ist</p>
<p>Problem gelöst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/998083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/998083</guid><dc:creator><![CDATA[k.m.w]]></dc:creator><pubDate>Sun, 19 Feb 2006 18:25:59 GMT</pubDate></item></channel></rss>