<?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[Double zu char* konvertieren]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich brauche eure Hilfe, ich ¨muss einen double in char* umwandelen.<br />
Bei google habe ich immer diese sprintf funktion gefunden, diese will ich aber am liebsten nicht benutzen wenn mann sie vermeiden kann.</p>
<p>Hat einer von euch eine bessere Idee.</p>
<p>Vielen Dank für eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/244165/double-zu-char-konvertieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 13:26:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/244165.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 26 Jun 2009 07:09:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 07:09:08 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich brauche eure Hilfe, ich ¨muss einen double in char* umwandelen.<br />
Bei google habe ich immer diese sprintf funktion gefunden, diese will ich aber am liebsten nicht benutzen wenn mann sie vermeiden kann.</p>
<p>Hat einer von euch eine bessere Idee.</p>
<p>Vielen Dank für eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733085</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733085</guid><dc:creator><![CDATA[ClaudeG]]></dc:creator><pubDate>Fri, 26 Jun 2009 07:09:08 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 07:10:14 GMT]]></title><description><![CDATA[<p>ClaudeG schrieb:</p>
<blockquote>
<p>diese will ich aber am liebsten nicht benutzen wenn mann sie vermeiden kann.</p>
</blockquote>
<p>Darf ich fragen, wieso? O_o</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733086</guid><dc:creator><![CDATA[feigling]]></dc:creator><pubDate>Fri, 26 Jun 2009 07:10:14 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 07:17:34 GMT]]></title><description><![CDATA[<p>naturlich dass du fragen, es ist so, ich mache zur Zeit ein Praktikum und mein Verantworlicher sieht diese funktion nicht als die bestmögliche an, also ich hab sie so benutzt :<br />
int k=8;<br />
int size=sizeof(int);<br />
char* b;<br />
b=(char*)malloc(size);<br />
sprintf(b, &quot;%d&quot;, k);</p>
<p>Und er hat mir gesagt dass sobald man ein malloc gebrauchen muss es immer gefährlich wird, darum frage ich ob vielleicht eine besser Lösung gibt!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733090</guid><dc:creator><![CDATA[ClaudeG]]></dc:creator><pubDate>Fri, 26 Jun 2009 07:17:34 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 07:45:49 GMT]]></title><description><![CDATA[<p>ClaudeG schrieb:</p>
<blockquote>
<p>Ich brauche eure Hilfe, ich ¨muss einen double in char* umwandelen.</p>
</blockquote>
<p>Vielleicht auch nicht. Verrat doch mal, was du willst und nicht womit Du glaubst es erreichen zu können. Du könntest auch mal erklären, was Du genau mit &quot;umwandeln&quot; meinst.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733099</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Fri, 26 Jun 2009 07:45:49 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 07:53:22 GMT]]></title><description><![CDATA[<p>Na ich muss eine Zahl (double) in einen char* umwandelen damit ich in danach mit hilfe einer Funktion die nur char* nutzen kann weiterverarbeiten kann, aber wie gesagt will die sprintf funktion nicht benutzen wenn es eine andere möglichkeit gibt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733103</guid><dc:creator><![CDATA[ClaudeG]]></dc:creator><pubDate>Fri, 26 Jun 2009 07:53:22 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 08:04:20 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;sstream&gt;
#include &lt;iostream&gt;

double d = 244.3;

std::ostringstream oss;
oss &lt;&lt; d;

std::cout &lt;&lt; oss.str().c_str() &lt;&lt; std::endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1733113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733113</guid><dc:creator><![CDATA[frickl0r]]></dc:creator><pubDate>Fri, 26 Jun 2009 08:04:20 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 08:10:19 GMT]]></title><description><![CDATA[<p>Flickr, noch eine kruze frage ist jetzt oss.str().c_str() mein char* oder wie muss ich das verstehen?</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733118</guid><dc:creator><![CDATA[ClaudeG]]></dc:creator><pubDate>Fri, 26 Jun 2009 08:10:19 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 08:18:05 GMT]]></title><description><![CDATA[<p>ClaudeG schrieb:</p>
<blockquote>
<p>Na ich muss eine Zahl (double) in einen char* umwandelen damit ich in danach mit hilfe einer Funktion die nur char* nutzen kann</p>
</blockquote>
<p>char* ist ein Zeiger auf char. Was hat das mit double zu tun? Was für einen Zeiger erwartet diese Funktion? Worauf soll da gezeigt werden? Auf eine textuelle Repräsentierung der Zahl? Oder direkt auf die double Variable (type punning) für binäre Ein-/Ausgabe? -- Deswegen fragte ich ja, was Du eigentlich erreichen willst.</p>
<p>ClaudeG schrieb:</p>
<blockquote>
<p>weiterverarbeiten kann, aber wie gesagt will die sprintf funktion nicht benutzen wenn es eine andere möglichkeit gibt.</p>
</blockquote>
<p>Ok. Das klingt so, als wärst Du an einer textuellen Repräsentierung der Zahl interessiert. Dann sag das auch. <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="🙂"
    /></p>
<p>Nimm std::string und std::stringstream (siehe frickl0rs Beitrag)</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733127</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Fri, 26 Jun 2009 08:18:05 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 08:31:34 GMT]]></title><description><![CDATA[<p>ClaudeG schrieb:</p>
<blockquote>
<p>Flickr, noch eine kruze frage ist jetzt oss.str().c_str() mein char* oder wie muss ich das verstehen?</p>
<p>Danke</p>
</blockquote>
<p>Es ist ein const char*. Also Ja.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733141</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 26 Jun 2009 08:31:34 GMT</pubDate></item><item><title><![CDATA[Reply to Double zu char* konvertieren on Fri, 26 Jun 2009 08:58:51 GMT]]></title><description><![CDATA[<p>feigling schrieb:</p>
<blockquote>
<p>ClaudeG schrieb:</p>
<blockquote>
<p>diese will ich aber am liebsten nicht benutzen wenn mann sie vermeiden kann.</p>
</blockquote>
<p>Darf ich fragen, wieso? O_o</p>
</blockquote>
<p>Hauptgrund: weil sprintf() eine C-Funtkion ist und es in C++ typsichere und stringlängensichere Funktionalität für soetwas gibt.</p>
<p>ClaudeG: Hier im Forum gibts eine FAQ, wo du gleich auf der ersten Seite das Topic &quot;Einmal Zahl nach String und zurück&quot; findest. Das hätte dir deine Frage eigentlich beantworten können. Schau also nach Möglichkeit künftig dort nach, wenn du Fragen wie diese hast, wo man davon ausgehen kann, dass sie des öfteren auftauchen. Im übrigen dürften dir die Antworten gezeigt haben dass es häufig sinnvoll ist, nicht mit Informationen zu geizen über dein eigentliches Problem das du beheben willst. Siehe dazu auch die mit <strong>wichtig</strong> markierten Threads hier im Forum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1733162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1733162</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Fri, 26 Jun 2009 08:58:51 GMT</pubDate></item></channel></rss>