<?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[widestrings in einfache strings konvertieren]]></title><description><![CDATA[<p>mit welcher funktion kann man aus widestrings (unicode TCHAR, wchar_t) wieder die zeichen in normale zeichenketten/-zeiger (char*, char[]) konvertieren?</p>
<p>TCHAR buffer[] = TEXT(&quot;Test&quot;);<br />
char sbuffer[]; // oder char *sbuffer, char sbuffer[100];</p>
<p>strcpy(sbuffer,buffer); // funktioniert so nicht</p>
<p>Ziel ist es das in sbuffer dann wieder &quot;Test&quot; steht, aber nur mit 4 bytes, statt 8.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/135189/widestrings-in-einfache-strings-konvertieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 06:10:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135189.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 31 Jan 2006 14:08:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:08:37 GMT]]></title><description><![CDATA[<p>mit welcher funktion kann man aus widestrings (unicode TCHAR, wchar_t) wieder die zeichen in normale zeichenketten/-zeiger (char*, char[]) konvertieren?</p>
<p>TCHAR buffer[] = TEXT(&quot;Test&quot;);<br />
char sbuffer[]; // oder char *sbuffer, char sbuffer[100];</p>
<p>strcpy(sbuffer,buffer); // funktioniert so nicht</p>
<p>Ziel ist es das in sbuffer dann wieder &quot;Test&quot; steht, aber nur mit 4 bytes, statt 8.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982052</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:08:37 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:19:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Vielleicht was aus der <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39492.html" rel="nofollow">FAQ</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/982070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982070</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:19:58 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:24:34 GMT]]></title><description><![CDATA[<p>nein genau andersherum (einen widestrings einem string zuweisen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982074</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982074</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:37:53 GMT]]></title><description><![CDATA[<p>Ist doch beides drin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982097</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982097</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:37:53 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:52:21 GMT]]></title><description><![CDATA[<p>ehrlich wo denn genau. für mich sieht das alles wie konvertierung string in widestring aus. wie müsste dann danach mein Code aussehen?:</p>
<p>use_facet&lt;ctype&lt;wchar_t&gt; &gt; (cout.getloc()).widen(sbuffer,sbuffer*2,buffer)</p>
<p>2. Problem, ich habe hier embedded VC++. Das kennt weder use_facet noch _USE oder welchen header muss man einbinden. Mir muss mal hier kurz auf die sprünge geholfen werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982114</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982114</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:52:21 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 14:56:39 GMT]]></title><description><![CDATA[<p>Stimmt, es steht wirklich nicht drin. Hab mich wohl verlesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982119</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 14:56:39 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 15:07:30 GMT]]></title><description><![CDATA[<p>Vielleicht gehts ja mit sprintf. Bei mir kompilierts jedenfalls.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982126</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982126</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 15:07:30 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 15:26:03 GMT]]></title><description><![CDATA[<p>mit sprintf(sbuffer,&quot;%s&quot;,buffer);</p>
<p>wird das erste zeichen in sbuffer geschrieben und sbuffer ist 1 byte groß. da fehlt noch was.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982149</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Tue, 31 Jan 2006 15:26:03 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 15:36:30 GMT]]></title><description><![CDATA[<p>Ich hatte folgendes getestet und das hat auch funktioniert.</p>
<pre><code class="language-cpp">char* test = new char[20];
wchar_t* wtest = L&quot;Hallo&quot;;
sprintf(test,&quot;%s&quot;,wtest);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/982167</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982167</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 15:36:30 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 15:53:16 GMT]]></title><description><![CDATA[<p>und wie ermittelts du die byte länge von sbuffer (oder bei dir test)? also ich komm hier immer nur auf länge 1.</p>
<p>strlen(sbuffer)*sizeof(char);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982186</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Tue, 31 Jan 2006 15:53:16 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Tue, 31 Jan 2006 15:56:45 GMT]]></title><description><![CDATA[<p>Machs mal so</p>
<pre><code class="language-cpp">sprintf(test,&quot;%S&quot;,wtest);
</code></pre>
<p>Das *sizeof(char) kannst du übrigens weglassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982201</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 31 Jan 2006 15:56:45 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:15:22 GMT]]></title><description><![CDATA[<p>ja das hab ich ja schon gemacht.<br />
du meinst wohl eher: i=strlen(sbuffer)</p>
<p>also bei mir kommt immer noch für i 1 raus und gespeichert wird nur das erste zeichen. bei dir nicht? ich weiss ab hier nicht mehr alzu weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982736</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:15:22 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:32:01 GMT]]></title><description><![CDATA[<p>Wenn das <strong>S</strong> im Formatstring groß ist, funktioniert bei mir alles (Compiler BCB5). Ich teste das gleich mal mit einen anderen Compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982742</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982742</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:32:01 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:36:53 GMT]]></title><description><![CDATA[<p>Funktioniert so auch mit DevCpp.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982747</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982747</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:36:53 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:38:56 GMT]]></title><description><![CDATA[<p>au schei... das große S hab ich gar nicht gesehen. ja funktioniert <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 />
und wenn ich aus dem string einen widestring wieder machen will (also wieder in die andere richtung), dann benutz ich einfach L&quot; &quot;, richtig?</p>
<p>was bedeutet das große S im gegensatz zum kleinen s?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982749</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:38:56 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:41:47 GMT]]></title><description><![CDATA[<p>%S ist aber kein Standard. Man sollte lieber %ls verwenden. (sagt zumindest die Manpage bei mir)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982750</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:41:47 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:44:27 GMT]]></title><description><![CDATA[<p>Folgendes habe ich in der Hilfe zu meinem Compiler gefunden</p>
<blockquote>
<p>The following table shows the formatted output specifiers for the Unicode family of functions. The table shows how the format specifier is used by printf and the Unicode family of output functions to output strings and characters.</p>
<p>Format specifier printf function Unicode function<br />
%c narrow wide<br />
%C wide narrow<br />
%hc narrow narrow<br />
%hC narrow narrow<br />
%lc wide wide<br />
%lC wide wide<br />
%s narrow wide<br />
%S wide narrow<br />
%hs narrow narrow<br />
%hS narrow narrow<br />
%ls wide wide<br />
%lS wide wide</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/982754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982754</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:44:27 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:51:32 GMT]]></title><description><![CDATA[<p>Verwirrendes Zeug <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Die Manpage (unter Suse 9.3) behauptet, %ls sei das selbe wie %S, nur dass man %S nicht benutzen soll, weil es kein Standard ist.</p>
<p>wcsrtombs (aus wchar.h / cwchar) soll wohl aber definitiv ANSI C sein und das gewünschte tun.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982757</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:51:32 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 08:46:01 GMT]]></title><description><![CDATA[<p>in der msdn find ich ja nix zu diesen einzelheiten...oder bin ich blind</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982759</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Wed, 01 Feb 2006 08:46:01 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 09:21:29 GMT]]></title><description><![CDATA[<p>Mit %ls funktioniert das auch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982808</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982808</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 01 Feb 2006 09:21:29 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 12:28:31 GMT]]></title><description><![CDATA[<p>Rio1 schrieb:</p>
<blockquote>
<p>ehrlich wo denn genau. für mich sieht das alles wie konvertierung string in widestring aus. wie müsste dann danach mein Code aussehen?:</p>
<p>use_facet&lt;ctype&lt;wchar_t&gt; &gt; (cout.getloc()).widen(sbuffer,sbuffer*2,buffer)</p>
</blockquote>
<p>eigentlich sieht der code fast genauso aus:</p>
<pre><code class="language-cpp">wchar_t wstring[6] = L&quot;Hallo&quot;;
char string[6];
use_facet&lt;ctype&lt;wchar_t&gt; &gt; (cout.getloc()).narrow(wstring, wstring+6,'?', string);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/982921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982921</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Wed, 01 Feb 2006 12:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Wed, 01 Feb 2006 15:09:35 GMT]]></title><description><![CDATA[<p>danke, aber geht das auch mit embedded VC++? Welche header müssen dazu eingebunden werden (das use_facet, ctype ... werden als compilererror angezeigt)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/983136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/983136</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Wed, 01 Feb 2006 15:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Thu, 02 Feb 2006 11:31:37 GMT]]></title><description><![CDATA[<p>müsste &lt;locale&gt; sein</p>
]]></description><link>https://www.c-plusplus.net/forum/post/983825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/983825</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Thu, 02 Feb 2006 11:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Thu, 02 Feb 2006 15:35:23 GMT]]></title><description><![CDATA[<p>#include &lt;locale.h&gt; konnte ich zwar einbinden aber folgende Compiliermeldung:</p>
<pre><code>errorC2065: 'use_facet' : undeclared identifier
errorC2065: 'ctype' : undeclared identifier
errorC2275: 'wchar_t' : illegal use of this type as an expression
errorC2059: syntax error : '&gt;'
</code></pre>
<p>klappt irgendwie nicht damit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984091</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984091</guid><dc:creator><![CDATA[Rio1]]></dc:creator><pubDate>Thu, 02 Feb 2006 15:35:23 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Thu, 02 Feb 2006 16:11:39 GMT]]></title><description><![CDATA[<p>Die Sachen sind bei mir (gcc 3.4.2 mit CodeBlocks) in iostream. Wobei der beim Ausführen von Otzes Code mit &quot;abnormal program termination&quot; rausgeht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984129</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984129</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 02 Feb 2006 16:11:39 GMT</pubDate></item><item><title><![CDATA[Reply to widestrings in einfache strings konvertieren on Thu, 02 Feb 2006 16:20:26 GMT]]></title><description><![CDATA[<p>Ich habs gerade nochmal mit dem BCB6 probiert und da geht es.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984146</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 02 Feb 2006 16:20:26 GMT</pubDate></item></channel></rss>