<?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[wostringstream convert to string]]></title><description><![CDATA[<p>Hallo leute,</p>
<p>ich habe etwas programmiert und nun suche ich eine elegante Möglichkeit meinen wostringstream variable in eine string variable zu überführen:</p>
<p>Mein Code mit dem ich die einzelnen Bytes der Devices überführe lautet wie folgt:</p>
<pre><code>for(int i=0; i&lt;6; i++){
    tmp&lt;&lt;hex&lt;&lt;m_device_info.Adress.rgBytes[i];
    if (i&lt;5)
     tmp&lt;&lt;L&quot;:&quot;;
 }
</code></pre>
<p>Dabei ist mein tmp von Datentyp wostringstream.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/311560/wostringstream-convert-to-string</link><generator>RSS for Node</generator><lastBuildDate>Mon, 03 Aug 2026 14:16:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/311560.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 08 Dec 2012 15:10:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to wostringstream convert to string on Sat, 08 Dec 2012 15:10:31 GMT]]></title><description><![CDATA[<p>Hallo leute,</p>
<p>ich habe etwas programmiert und nun suche ich eine elegante Möglichkeit meinen wostringstream variable in eine string variable zu überführen:</p>
<p>Mein Code mit dem ich die einzelnen Bytes der Devices überführe lautet wie folgt:</p>
<pre><code>for(int i=0; i&lt;6; i++){
    tmp&lt;&lt;hex&lt;&lt;m_device_info.Adress.rgBytes[i];
    if (i&lt;5)
     tmp&lt;&lt;L&quot;:&quot;;
 }
</code></pre>
<p>Dabei ist mein tmp von Datentyp wostringstream.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2278465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2278465</guid><dc:creator><![CDATA[C++Beginner558]]></dc:creator><pubDate>Sat, 08 Dec 2012 15:10:31 GMT</pubDate></item><item><title><![CDATA[Reply to wostringstream convert to string on Sat, 08 Dec 2012 15:18:09 GMT]]></title><description><![CDATA[<blockquote>
<p>nun suche ich eine elegante Möglichkeit meinen wostringstream variable in eine string variable zu überführen</p>
</blockquote>
<p>Bitte nochmal erklären, was du willst.<br />
Auf Anhieb denke ich an das:</p>
<pre><code>std::wstring wstr = tmp.str();  

// Oder was willst du? std::string?
// Das ginge so:
std::string str(wstr.begin(), wstr.end()); 
// Achtung, kann zu Überläufen führen, da du wahrscheinlich Zeichen in deinem Stringstream hast die ein char nicht repräsentieren kann
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2278467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2278467</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 08 Dec 2012 15:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to wostringstream convert to string on Sat, 08 Dec 2012 15:34:39 GMT]]></title><description><![CDATA[<p>Das war genau meine Idee, aber wenn ich das nun in meine ListBox überführen will, bekomme ich einige Fehlermeldungen.</p>
<p>Mein Ziel: tmp in meine listbox bei WinForms zu überführen.</p>
<p>Mein Vorgehen:</p>
<pre><code>for(int i=0; i&lt;6; i++){
    tmp&lt;&lt;hex&lt;&lt;m_device_info.Adress.rgBytes[i];
    if (i&lt;5)
     tmp&lt;&lt;L&quot;:&quot;;
 }

 listBox2-&gt;Items-&gt;Add(tmp.str());
</code></pre>
<p>Meine Fehlermeldung:</p>
<blockquote>
<p>&quot;error C2664:'System::Windows::Forms::ListBox::ObjectCollection::Add' convert 'wchar_t' in 'system::object ^' not possible&quot;</p>
</blockquote>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2278474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2278474</guid><dc:creator><![CDATA[C++Beginner558]]></dc:creator><pubDate>Sat, 08 Dec 2012 15:34:39 GMT</pubDate></item><item><title><![CDATA[Reply to wostringstream convert to string on Sat, 08 Dec 2012 16:14:16 GMT]]></title><description><![CDATA[<p>Das ist nicht C++, oder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2278487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2278487</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 08 Dec 2012 16:14:16 GMT</pubDate></item></channel></rss>