<?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 in chararray umwandeln ( ich weiß, ich bin nicht der erste ..)]]></title><description><![CDATA[<p>Hallo .. ich weiß, diese frage gibts im weg wie sand am meer, aber ich bin trotzdem nicht fündig geworden. Einer hats mit einer codezeile, der andere brauch 50 und ich weiss jetzt nicht was stimmt .. Die Stringlänge kann bis zur Umwandlung verschieden sein. D.h. ich sollte vorher die Stringlänge auslesen können um dann die arraygröße bestimmen zu können ..</p>
<p>Ich hab das mal wie ein anfänger das so macht mit static_cast probiert aber das geht natürlich nicht. wäre ja auch viel zu unkompliziert</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/195738/string-in-chararray-umwandeln-ich-weiß-ich-bin-nicht-der-erste</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 10:20:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/195738.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 21 Oct 2007 13:00:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:00:28 GMT]]></title><description><![CDATA[<p>Hallo .. ich weiß, diese frage gibts im weg wie sand am meer, aber ich bin trotzdem nicht fündig geworden. Einer hats mit einer codezeile, der andere brauch 50 und ich weiss jetzt nicht was stimmt .. Die Stringlänge kann bis zur Umwandlung verschieden sein. D.h. ich sollte vorher die Stringlänge auslesen können um dann die arraygröße bestimmen zu können ..</p>
<p>Ich hab das mal wie ein anfänger das so macht mit static_cast probiert aber das geht natürlich nicht. wäre ja auch viel zu unkompliziert</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389329</guid><dc:creator><![CDATA[mulo]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:00:28 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:07:48 GMT]]></title><description><![CDATA[<p>Meinst Du sowas?</p>
<pre><code class="language-cpp">string s;
char* arr = new char[s.size() + 1];
copy(s.begin(), s.end(), arr);
arr[s.size()] = '\0';
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1389333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389333</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:07:48 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:08:40 GMT]]></title><description><![CDATA[<p>Meinst du sowas?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int main() {

        string input = &quot;FooBla&quot;;
        const char* chararray = input.c_str();

        cout &lt;&lt; chararray &lt;&lt; endl;

        return 0;

}
</code></pre>
<p>Oder eher sowas?</p>
<pre><code class="language-cpp">char *chararray = new char [input.size()+1];
strcpy (chararray, input.c_str());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1389334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389334</guid><dc:creator><![CDATA[Mario Sandler]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:08:40 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:23:00 GMT]]></title><description><![CDATA[<p>wenns unbedingt ein Einzeiler sein soll</p>
<pre><code class="language-cpp">char* p = static_cast&lt; char* &gt;( memcpy( new char[ s.size() + 1 ], s.c_str(), s.size() + 1 ) );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1389339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389339</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:23:00 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:44:12 GMT]]></title><description><![CDATA[<p><a href="http://Storm.Xapek.de" rel="nofollow">Storm.Xapek.de</a> schrieb:</p>
<blockquote>
<p>Meinst du sowas?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int main() {

        string input = &quot;FooBla&quot;;
        const char* chararray = input.c_str();

        cout &lt;&lt; chararray &lt;&lt; endl;

        return 0;

}
</code></pre>
<p>Oder eher sowas?</p>
<pre><code class="language-cpp">char *chararray = new char [input.size()+1];
strcpy (chararray, input.c_str());
</code></pre>
</blockquote>
<p>Danke an alle <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="🙂"
    /> .. Was is der Unterschied zwischen der ersten und der zweiten Methode`?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389351</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389351</guid><dc:creator><![CDATA[mulo]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:44:12 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Sun, 21 Oct 2007 13:58:41 GMT]]></title><description><![CDATA[<p>Storms zweite, campers und meine Methode erzeugen ein neues veränderbares Array, welches Du selbst freigeben musst. Storms erste Methode liefert Dir ein unveränderbares (const) Abbild des Strings, welches gültig bleibt bis Du den String veränderst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389359</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Sun, 21 Oct 2007 13:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Mon, 22 Oct 2007 13:37:20 GMT]]></title><description><![CDATA[<p>Also mein BCB 6 schluckt das nicht ..</p>
<pre><code class="language-cpp">string s = edi_display-&gt;Text;
char* arr = new char[s.size() + 1];
copy(s.begin(), s.end(), arr);
arr[s.size()] = '\0';
</code></pre>
<p>edi_display ist ein Editfeld, dessen Inhalt ich per Knopfdruck einlesen und dann auf Inhalt und bestimmte Zeichen untersuchen will... Daher das Umwandeln in ein Chararray.</p>
<p>Ich erhalte folgende Fehler:</p>
<pre><code>[C++ Error] Unit1.cpp(1): E2451 Undefined symbol 'string'
[C++ Error] Unit1.cpp(1): E2379 Statement missing ;
[C++ Error] Unit1.cpp(2): E2451 Undefined symbol 's'
[C++ Error] Unit1.cpp(3): E2268 Call to undefined function 'copy'
[C++ Warning] Unit1.cpp(5): W8004 'arr' is assigned a value that is never used
</code></pre>
<p>(Zeilennummern hab ich angepasst für euch)</p>
<p>Gruß</p>
<p>// btw könnte das jemand mal bitte ins BCB Forum schieben, danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389989</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389989</guid><dc:creator><![CDATA[mulo]]></dc:creator><pubDate>Mon, 22 Oct 2007 13:37:20 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Mon, 22 Oct 2007 13:37:50 GMT]]></title><description><![CDATA[<p>versuch's mal mit &quot;std::&quot; vor den betroffenen Namen (und natürlich mußt du die entsprechenden Header auch einbinden).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389994</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 22 Oct 2007 13:37:50 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Mon, 22 Oct 2007 13:55:11 GMT]]></title><description><![CDATA[<p>Wenn du mit dem BCB arbeitest, kannst du direkt die Methoden der Klasse 'AnsiString' benutzen (s. BCB-Hilfe).<br />
Du brauchst nicht erst ein char-Array zu erstellen (ist ja schließlich C++, kein C).<br />
Bei AnsiString mußt du nur beachten, daß der Index bei 1 anfängt:</p>
<pre><code class="language-cpp">AnsiString sText = edi_display-&gt;Text;
for(int i=1; i&lt;=sText.Length(); i++)
{
  char c = sText[i];

  // nun kannst du mit den einzelnen Zeichen machen, was du willst!
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1390006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1390006</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Mon, 22 Oct 2007 13:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Mon, 22 Oct 2007 19:45:15 GMT]]></title><description><![CDATA[<p>ach ne .. hat sich erledigt,</p>
<p>aber wir wandle ich einen Ansistring in einen double um?</p>
<p>AnsiStrToDouble() ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1390187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1390187</guid><dc:creator><![CDATA[mulo]]></dc:creator><pubDate>Mon, 22 Oct 2007 19:45:15 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Tue, 23 Oct 2007 05:46:35 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-18038.html" rel="nofollow">CStoll</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html" rel="nofollow">VCL/CLX (Borland C++ Builder)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1390296</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1390296</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 23 Oct 2007 05:46:35 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Tue, 23 Oct 2007 06:17:36 GMT]]></title><description><![CDATA[<p>StrToFloat(); gibts vom Borland, allerdings kein StrToDouble();<br />
eventuell reicht das ?!</p>
<p>EDIT: es muss reichen</p>
<p>long double StrToFloat (AnsiString S);</p>
<p>laut Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1390310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1390310</guid><dc:creator><![CDATA[Ceos]]></dc:creator><pubDate>Tue, 23 Oct 2007 06:17:36 GMT</pubDate></item><item><title><![CDATA[Reply to string in chararray umwandeln ( ich weiß, ich bin nicht der erste ..) on Tue, 23 Oct 2007 14:36:24 GMT]]></title><description><![CDATA[<p>AnsiStrings haben allerdings auch die Funktion ToDouble().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1390605</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1390605</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Tue, 23 Oct 2007 14:36:24 GMT</pubDate></item></channel></rss>