<?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 Char To String ?]]></title><description><![CDATA[<p>Moinsen,</p>
<p>hab da grad nen Problem mit der Konvertierung von String nach *Char.</p>
<p>Code:</p>
<p>AnsiString Dot = Label1-&gt;Caption;<br />
char *str1 = Dot.c_str();<br />
char Fg[10];<br />
strncpy (Fg, str1, 5);<br />
Label2-&gt;Caption = Fg;</p>
<p>Wenn Label1 = Hello World; dann ist Label5 = Hello - oder nicht ?</p>
<p>Er zeigt mir auch &quot;Hello&quot; an, jedoch in so einem Format: HelloP#j5ä=j&amp;k.d usw.</p>
<p>Heißt für mich irgendeine Konvertierung funktioniert hier nicht richtig, nur welche ?</p>
<p>Thx 4 Answers</p>
<p>Mfg Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/204638/string-to-char-to-string</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 16:14:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/204638.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Feb 2008 16:11:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 16:11:48 GMT]]></title><description><![CDATA[<p>Moinsen,</p>
<p>hab da grad nen Problem mit der Konvertierung von String nach *Char.</p>
<p>Code:</p>
<p>AnsiString Dot = Label1-&gt;Caption;<br />
char *str1 = Dot.c_str();<br />
char Fg[10];<br />
strncpy (Fg, str1, 5);<br />
Label2-&gt;Caption = Fg;</p>
<p>Wenn Label1 = Hello World; dann ist Label5 = Hello - oder nicht ?</p>
<p>Er zeigt mir auch &quot;Hello&quot; an, jedoch in so einem Format: HelloP#j5ä=j&amp;k.d usw.</p>
<p>Heißt für mich irgendeine Konvertierung funktioniert hier nicht richtig, nur welche ?</p>
<p>Thx 4 Answers</p>
<p>Mfg Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449913</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Tue, 05 Feb 2008 16:11:48 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 16:23:34 GMT]]></title><description><![CDATA[<p>Laut Debugger stimmt alles, bei mir steht auch immer &quot;Hello&quot;, vielleicht funzt ja auch dein strncpy nicht richtig, denn in der Hilfe steht auch:</p>
<blockquote>
<p>[..]wird eine entsprechende <strong>zusätzliche Anzahl von Nullzeichen</strong> an destination angehängt[..]</p>
</blockquote>
<p>Versuch einmal vorher dein Chararray auf 0 zu setzen:</p>
<pre><code class="language-cpp">for(int i=0;i&lt;strlen(Fg);i++) //strlen ergibt hier 10, benötigt include-Datei string.h (glaub ich)
{
   Fg[i]='\0';
}
</code></pre>
<p>Versuchs mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449926</guid><dc:creator><![CDATA[o*amp*oler]]></dc:creator><pubDate>Tue, 05 Feb 2008 16:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 16:40:07 GMT]]></title><description><![CDATA[<p>Die Variable vom Typ char muss nach der Funktion strncpy() noch terminiert werden.</p>
<p>Fg[10] = 0x00;</p>
<p>Dann stimmts wieder <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="😉"
    /> *g*</p>
<p>Dennoch bleibt ein Problem und zwar ist es die Funktion strncpy() .. ich kann ihr lediglich einen Endwert zuweisen aber keinen Anfangswert, so das ich jeweils Blöcke aus einer Variablen heraus kopieren könnte.</p>
<p>Gibt es da noch ne andere Funktion die dies beherrscht ?</p>
<p>Mfg Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449938</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Tue, 05 Feb 2008 16:40:07 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 16:49:35 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Vermutlich mittels Pointerarithmetik und memcpy.<br />
Aber wozu? Warum nicht gleich AnsiString-Methoden benutzen?</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449950</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 05 Feb 2008 16:49:35 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 17:44:46 GMT]]></title><description><![CDATA[<p>Gefunden auf <a href="http://entwickler-forum.de/" rel="nofollow">http://entwickler-forum.de/</a></p>
<p>Code:<br />
AnsiString a;<br />
AnsiString b;</p>
<p>a = &quot;Hello World&quot;;<br />
b = a.SubString (7,5);</p>
<p>b = &quot;World&quot;;</p>
<p>Besten Dank, das oben von <a href="http://entwickler-forum.de/" rel="nofollow">entwickler-forum.de/</a> ist genau das was ich suche!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449951</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449951</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Tue, 05 Feb 2008 17:44:46 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 16:54:32 GMT]]></title><description><![CDATA[<p>Apropo memcpy:</p>
<blockquote>
<p>Prototyp</p>
<p>*<em>void *memcpy(void *dest, const void <em>src, size_t n);</em></em><br />
void *_wmemcpy(void *dest, const void *src, size_t n);</p>
<p>Beschreibung</p>
<p>Kopiert einen Block von n Bytes.</p>
<p>memcpy ist unter UNIX System V verfügbar.</p>
<p>Die Funktion kopiert n Bytes von src nach dest. Überlappen sich scr und dest, ist das Verhalten von memcpy undefiniert.</p>
<p>Rückgabewert<br />
**<br />
memcpy liefert dest zurück.**</p>
</blockquote>
<p>Müsste das nicht heißen char *memcpy(...)???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449952</guid><dc:creator><![CDATA[o*amp*oler]]></dc:creator><pubDate>Tue, 05 Feb 2008 16:54:32 GMT</pubDate></item><item><title><![CDATA[Reply to String To Char To String ? on Tue, 05 Feb 2008 17:03:10 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Nein denn memcpy ist ja nicht zum kopieren von Strings, sondern von typlosen Bytes. Du kannst mit memcpy alles mögliche kopieren wenn du weißt was du tust.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449962</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 05 Feb 2008 17:03:10 GMT</pubDate></item></channel></rss>