<?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[const char* in char kopieren]]></title><description><![CDATA[<p>Hallo</p>
<p>wie kann ich in ein char array ein const char* reinkopieren?</p>
<p>cap ist ein string:</p>
<pre><code class="language-cpp">const char *p = cap.c_str();
	char x[500] = &quot; &quot;;
	strcpy(x, p);
</code></pre>
<p>fehler:</p>
<p>'x': 'char [500]' unterscheidet sich von 'int' in Bezug auf die Anzahl vorgenommener Dereferenzierungen</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/205267/const-char-in-char-kopieren</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 23:44:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/205267.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Feb 2008 13:33:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to const char* in char kopieren on Tue, 12 Feb 2008 13:33:35 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>wie kann ich in ein char array ein const char* reinkopieren?</p>
<p>cap ist ein string:</p>
<pre><code class="language-cpp">const char *p = cap.c_str();
	char x[500] = &quot; &quot;;
	strcpy(x, p);
</code></pre>
<p>fehler:</p>
<p>'x': 'char [500]' unterscheidet sich von 'int' in Bezug auf die Anzahl vorgenommener Dereferenzierungen</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454387</guid><dc:creator><![CDATA[DERDA]]></dc:creator><pubDate>Tue, 12 Feb 2008 13:33:35 GMT</pubDate></item><item><title><![CDATA[Reply to const char* in char kopieren on Tue, 12 Feb 2008 13:43:19 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">strncpy(&amp;(x[0]), p, 499);
</code></pre>
<p>sollte funktionieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454398</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 12 Feb 2008 13:43:19 GMT</pubDate></item><item><title><![CDATA[Reply to const char* in char kopieren on Tue, 12 Feb 2008 13:55:45 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">const char* p = cap.c_str();
    char x[500] = &quot; &quot;;
    strcpy(x, p);
</code></pre>
<p>Aua. Das kann knallen!</p>
<pre><code class="language-cpp">char arr[500];
std::strncpy(arr, cap.c_str(), 500);
</code></pre>
<p>oder:</p>
<pre><code class="language-cpp">std::vector&lt;char&gt; arr(cap.begin(), cap.end());
char* ptr(&amp;arr[0]);
</code></pre>
<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454414</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 12 Feb 2008 13:55:45 GMT</pubDate></item></channel></rss>