<?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[StringCbCopyN]]></title><description><![CDATA[<p>Ich versuche grade verzweifel einen String in einen LPSTR zu kopieren. Dabei möchte in den ersten Teil eines Pfades aufbauen und den zweiten teil(dateinamen) später anfügen. soweit komme ich jedoch nicht, wie ich das im debug sehe, gibt es ein problem bei umkopieren der inhalte innerhalb der routine. der zielpointer ist wohl das problem(pcbuffer), allerdings verstehe ich nicht ganz wieso:</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{</p>
<p>LPTSTR pcBuffer = NULL;<br />
int len = sizeof(L&quot;C:\\temp\\test\&quot;);</p>
<p>StringCbCopyN(pcBuffer, MAX_PATH, L&quot;C:\\temp\\test\&quot;, len);</p>
<p>return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/169240/stringcbcopyn</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 16:00:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/169240.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jan 2007 13:41:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to StringCbCopyN on Wed, 03 Jan 2007 13:41:55 GMT]]></title><description><![CDATA[<p>Ich versuche grade verzweifel einen String in einen LPSTR zu kopieren. Dabei möchte in den ersten Teil eines Pfades aufbauen und den zweiten teil(dateinamen) später anfügen. soweit komme ich jedoch nicht, wie ich das im debug sehe, gibt es ein problem bei umkopieren der inhalte innerhalb der routine. der zielpointer ist wohl das problem(pcbuffer), allerdings verstehe ich nicht ganz wieso:</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{</p>
<p>LPTSTR pcBuffer = NULL;<br />
int len = sizeof(L&quot;C:\\temp\\test\&quot;);</p>
<p>StringCbCopyN(pcBuffer, MAX_PATH, L&quot;C:\\temp\\test\&quot;, len);</p>
<p>return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1201901</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1201901</guid><dc:creator><![CDATA[Mattes65]]></dc:creator><pubDate>Wed, 03 Jan 2007 13:41:55 GMT</pubDate></item><item><title><![CDATA[Reply to StringCbCopyN on Wed, 03 Jan 2007 13:44:54 GMT]]></title><description><![CDATA[<p>Ich weiß zwar nicht, woher du diese Funktion hast, aber üblicherweise erwarten derartige Funktionen, daß du <strong>vorher</strong> genügend Speicher reservierst:</p>
<pre><code class="language-cpp">int len = sizeof(L&quot;C:\\temp\\test\\&quot;);
LPTSTR = new TCHAR[len];
StringCbCopyN(pcBuffer, MAX_PATH, L&quot;C:\\temp\\test\\&quot;, len);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1201906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1201906</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 03 Jan 2007 13:44:54 GMT</pubDate></item><item><title><![CDATA[Reply to StringCbCopyN on Wed, 03 Jan 2007 17:18:44 GMT]]></title><description><![CDATA[<p>danke <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>
<p>Aber jetzt hab ich ein Problem mit dem sizeof Operator und wchar_t, er ermittelt mir die falsche Länge.</p>
<p>die variable Path ist vom typ wchar_t* mit max. 256Byte Speicher allociert und hat<br />
den Inhalt<br />
<a href="http://i105.photobucket.com/albums/m239/souljumper/test.jpg" rel="nofollow">http://i105.photobucket.com/albums/m239/souljumper/test.jpg</a></p>
<p>ich möchte da jetzt wissen wieviele zeichen dort enthalten sind.</p>
<pre><code class="language-cpp">int len = sizeof(Path) / sizeof(wchar_t);
</code></pre>
<p>Seltsamerweise spuckt er mir jetzt aus, das len den Wert 2 hat. wieso das? diese ganze strings, chars und dazu das unicode macht einen ganz confuse :xmas2:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1202086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1202086</guid><dc:creator><![CDATA[Mattes65]]></dc:creator><pubDate>Wed, 03 Jan 2007 17:18:44 GMT</pubDate></item><item><title><![CDATA[Reply to StringCbCopyN on Wed, 03 Jan 2007 17:28:21 GMT]]></title><description><![CDATA[<p>sizeof(Path) ist immer 4.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1202096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1202096</guid><dc:creator><![CDATA[4]]></dc:creator><pubDate>Wed, 03 Jan 2007 17:28:21 GMT</pubDate></item><item><title><![CDATA[Reply to StringCbCopyN on Wed, 03 Jan 2007 17:37:13 GMT]]></title><description><![CDATA[<blockquote>
<p>ich möchte da jetzt wissen wieviele zeichen dort enthalten sind.</p>
</blockquote>
<pre><code class="language-cpp">lstrlen(Path)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1202103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1202103</guid><dc:creator><![CDATA[Antwort]]></dc:creator><pubDate>Wed, 03 Jan 2007 17:37:13 GMT</pubDate></item></channel></rss>