<?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 to wchar_t*]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich habe eine Funktion SetString welche den Typ wchar_t* erwartet, etwa so:</p>
<pre><code class="language-cpp">wchar_t* wert = L&quot;280.25&quot;;
hr = pOutput-&gt;SetString(device, 0, 2, 9, wert);
</code></pre>
<p>Nun möchte ich gerne den Wert einer (double) Variablen als string der Funktion übergeben.</p>
<pre><code class="language-cpp">double Zahl;

//konvertiere double Zahl zu wchar_t* wert

hr = pOutput-&gt;SetString(device, 0, 2, 9, wert);
</code></pre>
<p>Gibt es eine Möglichkeit der Konvertierung von double nach wchar_t* ? Ist es möglich dann auch die Formatierung (ala &quot;%.2f&quot;) festzulegen?</p>
<p>LG Alberich</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/282376/double-to-wchar_t</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 07:59:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/282376.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Feb 2011 20:27:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 20:34:47 GMT]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich habe eine Funktion SetString welche den Typ wchar_t* erwartet, etwa so:</p>
<pre><code class="language-cpp">wchar_t* wert = L&quot;280.25&quot;;
hr = pOutput-&gt;SetString(device, 0, 2, 9, wert);
</code></pre>
<p>Nun möchte ich gerne den Wert einer (double) Variablen als string der Funktion übergeben.</p>
<pre><code class="language-cpp">double Zahl;

//konvertiere double Zahl zu wchar_t* wert

hr = pOutput-&gt;SetString(device, 0, 2, 9, wert);
</code></pre>
<p>Gibt es eine Möglichkeit der Konvertierung von double nach wchar_t* ? Ist es möglich dann auch die Formatierung (ala &quot;%.2f&quot;) festzulegen?</p>
<p>LG Alberich</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023037</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Fri, 18 Feb 2011 20:34:47 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 20:31:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;sstream&gt;
#include &lt;string&gt;

void f()
{
   double d = 0.2;
   std::wostringstream oss;
   oss &lt;&lt; d;
   std::wstring s = oss.str();
   const wchar_t* c = s.c_str();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2023039</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023039</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 18 Feb 2011 20:31:00 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 20:45:19 GMT]]></title><description><![CDATA[<p>In der Zeile:<br />
std::wostringstream oss;<br />
Meckert der Compiler (MingW):<br />
expected constructor, destructor, or type conversion before &quot;oss&quot;</p>
<p>Liegt das vielleicht am compiler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023045</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023045</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Fri, 18 Feb 2011 20:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 21:06:29 GMT]]></title><description><![CDATA[<p>Probier's mal nur mit <code>std::wstringstream</code> , ohne <code>o</code> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023052</guid><dc:creator><![CDATA[fdfdg]]></dc:creator><pubDate>Fri, 18 Feb 2011 21:06:29 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 21:28:31 GMT]]></title><description><![CDATA[<p>gleiche Meldung vom Compiler <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>EDIT:<br />
Ich sollte vielleicht dazusagen dass ich mit wxDev C++ arbeite. Es handelt sich aber nur um eine KonsolenApplikation. Bin ich mit der Fragestellung hier vielleicht falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023053</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Fri, 18 Feb 2011 21:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 21:35:10 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void f()
{
   double d = 0.2;
   std::basic_ostringstream&lt;wchar_t&gt; oss;
   oss &lt;&lt; d;
   std::wstring s = oss.str();
   const wchar_t* c = s.c_str();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2023061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023061</guid><dc:creator><![CDATA[Vermutung?]]></dc:creator><pubDate>Fri, 18 Feb 2011 21:35:10 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 21:45:48 GMT]]></title><description><![CDATA[<p>Wir kommen der Lösung wohl näher, einzige Compiler-Meldung jetzt für die Zeile:</p>
<p>oss &lt;&lt; d;</p>
<p>expected constructor, destructor, or type conversion before '&lt;&lt;' token</p>
<p>Wenn ich diese Zeile auskommentiere meckert der compiler nicht, die Funktion<br />
SetString schreibt nun natürlich nichts da der String leer ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023065</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Fri, 18 Feb 2011 21:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 22:06:19 GMT]]></title><description><![CDATA[<p>Die Konversion des strings in const wchar_t* funktioniert, habe testweise:</p>
<pre><code class="language-cpp">std::wstring s = L&quot;0.2&quot;;
    const wchar_t* c = s.c_str();

    //SetString schreibt &quot;0.2&quot;
    hr = pOutput-&gt;SetString(device, 0, 2, 9, c);
</code></pre>
<p>Möglicherweise ist es einfacher (double)d in einen String mit Literal L zu konvertieren...<br />
Diese Typkonvertierungen machen mich fertig...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023072</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023072</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Fri, 18 Feb 2011 22:06:19 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Fri, 18 Feb 2011 23:53:04 GMT]]></title><description><![CDATA[<p>Alberich schrieb:</p>
<blockquote>
<p>expected constructor, destructor, or type conversion before '&lt;&lt;' token</p>
</blockquote>
<p>Vielleicht solltest du dir deine Entwicklungsumgebung noch mal neu aufsetzen. Es kann ja nicht sein, dass du Teile von C++ nicht benutzen kannst und immer drumherum schiffen musst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023116</guid><dc:creator><![CDATA[fdfdg]]></dc:creator><pubDate>Fri, 18 Feb 2011 23:53:04 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 00:24:20 GMT]]></title><description><![CDATA[<p>Kommt mir auch seltsam vor...</p>
<p>Bin jetzt soweit einen string in einen wide-string umwandeln zu können</p>
<pre><code class="language-cpp">std::string strc=&quot;100&quot;;
    std::wstring wstrc = std::wstring(strc.begin(), strc.end());
    const wchar_t* c = wstrc.c_str();
</code></pre>
<p>Aber diesem string eine double &quot;mitzugeben&quot; indem ich d in einen string umwandele geht schief...</p>
<p>Sehr seltsam...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023129</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023129</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Sat, 19 Feb 2011 00:24:20 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 01:39:48 GMT]]></title><description><![CDATA[<p>So, habe den code wie vorgeschlagen jetzt unter Visual C++ 2010.</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;windows.h&gt;

#include &lt;math.h&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
#include &lt;stdlib.h&gt;

...
   double d = 0.2;
   std::basic_ostringstream&lt;wchar_t&gt; oss;
   oss &lt;&lt; d;
   std::wstring s = oss.str();
   const wchar_t* c = s.c_str();
...
</code></pre>
<p>Meldung für Zeile</p>
<pre><code class="language-cpp">oss &lt;&lt; d;
</code></pre>
<p>Diese Deklaration hat keine Speicherklasse oder keinen Typspezifizierer</p>
<p>Wie kann das sein? Andere Umgebung, gleicher Fehler...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023145</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Sat, 19 Feb 2011 01:39:48 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 02:09:40 GMT]]></title><description><![CDATA[<p>Sehr wahrscheinlich liegt es an windows.h. windows.h definiert einen großen Haufen Makros, die sich mit allem möglichen beißen - heiße Kandidaten sind da min() und max().</p>
<p>Wenn du die dadurch ausgeklammerten Teile nicht unbedingt benötigst, kannst du versuchen, windows.h wie folgt einzubinden:</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include &lt;windows.h&gt;
#undef NOMINMAX
#undef WIN32_LEAN_AND_MEAN
</code></pre>
<p>Häufig reicht das schon. Falls nicht, oder falls du andere Microsoft-Bibliotheken benutzt, die den Kram brauchen - Teile von MFC kriegen beispielsweise Probleme, wenn die Makros min und max nicht vorhanden sind (wobei sich MFC wieder mit windows.h beißt und sich den Kram wohl an anderer Stelle holt. Das ist alles...äh...historisch gewachsen.) - wirst du den von windows.h abhängigen Code in eine eigene Übersetzungseinheit auslagern und so einpacken müssen, dass du ihn an anderer Stelle im Programm unabhängig davon benutzen kannst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023150</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sat, 19 Feb 2011 02:09:40 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 02:12:50 GMT]]></title><description><![CDATA[<p>Ok, dann hast du irgendwas in deinem Code (in einem der Includes oder einfach weiter oben), was die Funktionalität zerhaut.</p>
<p>Die windows.h dürfte es aber eigentlich nicht sein, benutze ich öfters mit allen möglichen Std-Lib-Sachen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023152</guid><dc:creator><![CDATA[fdfdg]]></dc:creator><pubDate>Sat, 19 Feb 2011 02:12:50 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 02:35:26 GMT]]></title><description><![CDATA[<p>Versuch mal</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;limits&gt; // std::numeric_limits&lt;&gt;::min() bzw. max()
</code></pre>
<p>Wahlweise &lt;algorithm&gt; (std::min, std::max), und compilerabhängig kann das mit anderen Standardheadern auch Probleme geben (Standardheader dürfen sich beliebig gegenseitig einbinden).</p>
<p>Siehe dazu auch <a href="http://support.microsoft.com/kb/143208/en-us" rel="nofollow">http://support.microsoft.com/kb/143208/en-us</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023154</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sat, 19 Feb 2011 02:35:26 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 09:15:54 GMT]]></title><description><![CDATA[<p>Welche MinGW-Version hast du denn? Denn die offizielle Version (3.irgendwas) kann keine Wide-Streams! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /><br />
Du mußt den ewigen Beta von MinGW 4.irgendwas nehmen. Oder am besten gleich den MS C++ Compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023174</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023174</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sat, 19 Feb 2011 09:15:54 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 10:17:00 GMT]]></title><description><![CDATA[<p>Vielen Dank für die Vorschläge!<br />
Ich habe wxDev C++ (7.3.1.3) nochmal komplett neu aufgesetzt, jetzt gibts keine Probleme mehr, auch nicht mit inkludierter windows.h. Keine Ahnung was da schiefgegangen ist...<br />
Nochmal vielen Dank, ist ein super Forum! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023190</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023190</guid><dc:creator><![CDATA[Alberich]]></dc:creator><pubDate>Sat, 19 Feb 2011 10:17:00 GMT</pubDate></item><item><title><![CDATA[Reply to double to wchar_t* on Sat, 19 Feb 2011 12:56:28 GMT]]></title><description><![CDATA[<p>Als Entwicklungsumgebung ist Visual Studio unter Windows auch keine schlechte Wahl.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2023247</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2023247</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 19 Feb 2011 12:56:28 GMT</pubDate></item></channel></rss>