<?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[String to Byte?]]></title><description><![CDATA[<p>Hallo,</p>
<p>meine RegSetValueEx() braucht einen Byte Wert als Eingabewert, meine Copy Funktion jedoch char. Da ich 2 Zeichenketten addieren möchte, habe ich beide als String definiert.</p>
<p>Nun ist meine Frage, wie bekomme ich einen String in BYTE konvertiert?</p>
<p>Vielen Dank im voraus und<br />
liebe Grüße<br />
Patrick</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/266229/string-to-byte</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 13:30:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/266229.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 May 2010 19:11:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 19:11:05 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>meine RegSetValueEx() braucht einen Byte Wert als Eingabewert, meine Copy Funktion jedoch char. Da ich 2 Zeichenketten addieren möchte, habe ich beide als String definiert.</p>
<p>Nun ist meine Frage, wie bekomme ich einen String in BYTE konvertiert?</p>
<p>Vielen Dank im voraus und<br />
liebe Grüße<br />
Patrick</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893009</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 19:11:05 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 19:13:34 GMT]]></title><description><![CDATA[<p>So:</p>
<pre><code class="language-cpp">reinterpret_cast&lt;const byte*&gt;(deinString.c_str());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1893011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893011</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Wed, 05 May 2010 19:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 19:17:56 GMT]]></title><description><![CDATA[<p>Code:</p>
<pre><code class="language-cpp">BYTE cString[] = reinterpret_cast&lt;const byte*&gt;(pfad.c_str());
</code></pre>
<p>Fehlermeldung:</p>
<pre><code>G:\C++\keylogger_installer\main.cpp||In function `int main(int, char**)':|
G:\C++\keylogger_installer\main.cpp|27|error: initializer fails to determine size of `cString'|
G:\C++\keylogger_installer\main.cpp|27|error: invalid initializer|
||=== Build finished: 2 errors, 0 warnings ===|
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1893016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893016</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 19:17:56 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 19:22:52 GMT]]></title><description><![CDATA[<p>Im konkreten Fall muss es</p>
<pre><code class="language-cpp">const BYTE* cString = reinterpret_cast&lt;const BYTE*&gt;(pfad.c_str());
</code></pre>
<p>lauten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893020</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Wed, 05 May 2010 19:22:52 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:01:31 GMT]]></title><description><![CDATA[<p>Ich merk schon, C++ mag mich richtig...</p>
<pre><code class="language-cpp">// BYTE cString[] = reinterpret_cast&lt;const byte*&gt;(pfad.c_str());
const BYTE* cString = reinterpret_cast&lt;const BYTE*&gt;(pfad.c_str());
    RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,strlen(reinterpret_cast&lt;char*&gt;(cString))+1);
</code></pre>
<p>Fehler:</p>
<pre><code>G:\C++\keylogger_installer\main.cpp||In function `int main(int, char**)':|
G:\C++\keylogger_installer\main.cpp|30|error: reinterpret_cast from type `const BYTE*' to type `char*' casts away constness|
||=== Build finished: 1 errors, 0 warnings ===|
</code></pre>
<p>Das wird mir schon peinlich langsam, dass ich das nicht hinbekomme und euch immer fragen muss :S</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893042</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 20:01:31 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:07:45 GMT]]></title><description><![CDATA[<p>Du darfst das const nicht einfach wegcasten, demnach musst du nach const char* casten.<br />
Oder gar nicht und gleich strlen(pfad.c_str())+1 schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893043</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893043</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Wed, 05 May 2010 20:07:45 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:13:28 GMT]]></title><description><![CDATA[<p>Patistar schrieb:</p>
<blockquote>
<pre><code class="language-cpp">strlen(reinterpret_cast&lt;char*&gt;(cString))+1
</code></pre>
</blockquote>
<p>WTF?</p>
<pre><code class="language-cpp">cString.length() + 1
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1893047</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893047</guid><dc:creator><![CDATA[Nukularfüsiker]]></dc:creator><pubDate>Wed, 05 May 2010 20:13:28 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:21:37 GMT]]></title><description><![CDATA[<p>Das Problem ist aber, dass .length() by BYTE nicht funktioniert?!</p>
<pre><code class="language-cpp">const BYTE* cString = reinterpret_cast&lt;const BYTE*&gt;(pfad.c_str());
RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,cString.length() + 1);
</code></pre>
<pre><code>G:\C++\key_installer\main.cpp||In function `int main(int, char**)':|
G:\C++\key_installer\main.cpp|31|error: request for member `length' in `cString', which is of non-class type `const BYTE*'|
||=== Build finished: 1 errors, 0 warnings ===|
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1893051</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893051</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 20:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:31:58 GMT]]></title><description><![CDATA[<p>Er meinte pfad.length().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893053</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Wed, 05 May 2010 20:31:58 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:33:01 GMT]]></title><description><![CDATA[<p>Ich glaub ich habe eine Lösung:</p>
<pre><code class="language-cpp">RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,reinterpret_cast&lt;const BYTE*&gt;(pfad.c_str()),strlen(pfad.c_str()) + 1);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1893054</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893054</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 20:33:01 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:34:35 GMT]]></title><description><![CDATA[<p>Und wieso zum Geier nicht so?</p>
<pre><code class="language-cpp">BYTE const* data = reinterpret_cast&lt;BYTE const*&gt;(pfad.c_str());
RegSetValueEx(NULL, &quot;EintragsName&quot;, 0, REG_SZ, data, pfad.length() + 1);
//                                                   ^^^^^^^^^^^^^^^^^
</code></pre>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893056</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893056</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 05 May 2010 20:34:35 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Wed, 05 May 2010 20:43:49 GMT]]></title><description><![CDATA[<p>Stimmt, da hätte ich auch drauf kommen können...</p>
<p>Vielen Dank <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893059</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893059</guid><dc:creator><![CDATA[Patistar]]></dc:creator><pubDate>Wed, 05 May 2010 20:43:49 GMT</pubDate></item><item><title><![CDATA[Reply to String to Byte? on Thu, 06 May 2010 07:11:02 GMT]]></title><description><![CDATA[<p>Patistar schrieb:</p>
<blockquote>
<p>Das Problem ist aber, dass .length() by BYTE nicht funktioniert?!</p>
</blockquote>
<p>Athar schrieb:</p>
<blockquote>
<p>Er meinte pfad.length().</p>
</blockquote>
<p>Ja richtig, sorry.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893132</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893132</guid><dc:creator><![CDATA[Nukularfüsiker]]></dc:creator><pubDate>Thu, 06 May 2010 07:11:02 GMT</pubDate></item></channel></rss>