<?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[Konvertierungsprobleme: Bekomme kein std::string aus wchar_t]]></title><description><![CDATA[<p>Hallo Leute/Helfer,<br />
ich habe folgendes Problem:<br />
Also ich habe eine Funktion die einen &quot;std::string&quot; erwartet à la:</p>
<pre><code>void getSectionValue(std::string)
</code></pre>
<p>Ich will mit einer Schleife automatisch und dynamisch verschiedene Namen generien à la:</p>
<pre><code>for (int i = 0; numObjects &gt; 4; i++)
{
    //leider brauche ich hierfür ein &quot;snwprintf&quot; das nur einen wchar_t erwartet 
    //keinen std::string.
    wchar_t temp[12];
    swprintf(temp, 256,&quot;object%d&quot;, i);

   // jetzt möchte ich getSectionValue aufrufen , das erwartet
   // ,aber einen std::string. Also: wie von wchar_t nach std::string ...
}
</code></pre>
<p>Auf gut Deutsch:<br />
<strong>Ich muss von <em>&quot;wchar_t&quot;</em> auf <em>&quot;std::string&quot;</em>.</strong></p>
<p>Danke an jeden der mir helfen kann/will/versucht zu helfen.</p>
<p><strong>MfG</strong><br />
<strong>spy</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/213490/konvertierungsprobleme-bekomme-kein-std-string-aus-wchar_t</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 06:26:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/213490.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 18 May 2008 16:11:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Konvertierungsprobleme: Bekomme kein std::string aus wchar_t on Sun, 18 May 2008 16:11:43 GMT]]></title><description><![CDATA[<p>Hallo Leute/Helfer,<br />
ich habe folgendes Problem:<br />
Also ich habe eine Funktion die einen &quot;std::string&quot; erwartet à la:</p>
<pre><code>void getSectionValue(std::string)
</code></pre>
<p>Ich will mit einer Schleife automatisch und dynamisch verschiedene Namen generien à la:</p>
<pre><code>for (int i = 0; numObjects &gt; 4; i++)
{
    //leider brauche ich hierfür ein &quot;snwprintf&quot; das nur einen wchar_t erwartet 
    //keinen std::string.
    wchar_t temp[12];
    swprintf(temp, 256,&quot;object%d&quot;, i);

   // jetzt möchte ich getSectionValue aufrufen , das erwartet
   // ,aber einen std::string. Also: wie von wchar_t nach std::string ...
}
</code></pre>
<p>Auf gut Deutsch:<br />
<strong>Ich muss von <em>&quot;wchar_t&quot;</em> auf <em>&quot;std::string&quot;</em>.</strong></p>
<p>Danke an jeden der mir helfen kann/will/versucht zu helfen.</p>
<p><strong>MfG</strong><br />
<strong>spy</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1511657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1511657</guid><dc:creator><![CDATA[spy256]]></dc:creator><pubDate>Sun, 18 May 2008 16:11:43 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierungsprobleme: Bekomme kein std::string aus wchar_t on Sun, 18 May 2008 16:16:30 GMT]]></title><description><![CDATA[<p>So hat sich erledigt. Man kann einfach</p>
<pre><code>snprintf();
</code></pre>
<p>benützen. Das lässt sich dann nach std::string casten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1511664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1511664</guid><dc:creator><![CDATA[spy512]]></dc:creator><pubDate>Sun, 18 May 2008 16:16:30 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierungsprobleme: Bekomme kein std::string aus wchar_t on Sun, 18 May 2008 16:17:07 GMT]]></title><description><![CDATA[<ol>
<li></li>
</ol>
<pre><code class="language-cpp">swprintf(temp, 256,L&quot;object%d&quot;, i);
</code></pre>
<p><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="😉"
    /><br />
2.</p>
<pre><code class="language-cpp">wchar_t* test = L&quot;Hello&quot;;
std::wstring test2(test);
std::string test3(test2.begin(), test2.end());
</code></pre>
<p>wäre eine möglichkeit <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>edit: oh, zu spät <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1511665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1511665</guid><dc:creator><![CDATA[sothis_]]></dc:creator><pubDate>Sun, 18 May 2008 16:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to Konvertierungsprobleme: Bekomme kein std::string aus wchar_t on Mon, 19 May 2008 07:36:59 GMT]]></title><description><![CDATA[<p>Trotzdem danke. <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>
<p><strong>MfG<br />
spy1024</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1511975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1511975</guid><dc:creator><![CDATA[spy1024]]></dc:creator><pubDate>Mon, 19 May 2008 07:36:59 GMT</pubDate></item></channel></rss>