<?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 hex-code to byte array]]></title><description><![CDATA[<p>Hallo,</p>
<p>gibt es sowas schon in irgendeiner lib?</p>
<ol>
<li>string to hex-code</li>
<li>hex-code to byte array</li>
<li>string (also Klartext) to byte array</li>
</ol>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/248136/string-to-hex-code-to-byte-array</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 23:46:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/248136.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Aug 2009 08:22:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 08:22:49 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>gibt es sowas schon in irgendeiner lib?</p>
<ol>
<li>string to hex-code</li>
<li>hex-code to byte array</li>
<li>string (also Klartext) to byte array</li>
</ol>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1763912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1763912</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Thu, 20 Aug 2009 08:22:49 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 08:29:43 GMT]]></title><description><![CDATA[<p>1: Du willst die Zeichen als Hexadezimale Werte ausgeben lassen?</p>
<pre><code class="language-cpp">std::string str = &quot;Hallo Welt&quot;;
std::copy( str.begin(), str.end(), std::ostream_iterator&lt;int&gt;( std::cout &lt;&lt; std::hex, &quot; &quot; ) );
</code></pre>
<p>2: In welcher Form liegen die &quot;Hex-Codes&quot; denn vor? Auch als String?</p>
<p>3:</p>
<pre><code class="language-cpp">const char* ptr = str.c_str();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1763918</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1763918</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 20 Aug 2009 08:29:43 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 14:17:02 GMT]]></title><description><![CDATA[<p>Und andersrum ?<br />
Ich brauche nämlich GENAU DAS.</p>
<p>EDIT: Auch wenns bei mir doch nicht ganz so ist aber wäre ganz nett,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1764200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764200</guid><dc:creator><![CDATA[5cript]]></dc:creator><pubDate>Thu, 20 Aug 2009 14:17:02 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 14:30:53 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/10754">@David_pb</a>:<br />
Danke! Zu 2) Für das Lesen auf eine Chipkarte liegen sie mir als BYTE-Array vor<br />
und für das Schreiben muss der String in ein BYTE-Array.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1764205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764205</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Thu, 20 Aug 2009 14:30:53 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 15:36:56 GMT]]></title><description><![CDATA[<p>wobei BYTE =<br />
typedef unsigned char BYTE</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1764242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764242</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Thu, 20 Aug 2009 15:36:56 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Thu, 20 Aug 2009 15:57:06 GMT]]></title><description><![CDATA[<p>Wenn du ein Bytearray hast dann kannst du diese doch einfach in den string kopieren? Oder versteh ich dich falsch? Ggf wär ein Codebeispiel zur Verdeutlichung gut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1764248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764248</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 20 Aug 2009 15:57:06 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Fri, 21 Aug 2009 15:42:51 GMT]]></title><description><![CDATA[<p>Fall 1: lesen</p>
<pre><code class="language-cpp">typedef unsigned char BYTE;
typedef BYTE *LPBYTE;

LPBYTE readbuffer;
string res;

readbuffer = read();

//im readbuffer sind nun hex-daten
res = reinterpret_cast&lt;char *&gt;(abyData);	//wie dekodiere ich res?
</code></pre>
<p>Fall 2: schreiben</p>
<pre><code class="language-cpp">typedef unsigned char BYTE;
typedef BYTE *LPBYTE;

LPBYTE sendbuffer;
string str = &quot;Das moechte ich verschicken&quot;;
copy( str.begin(), str.end(), ostream_iterator&lt;int&gt;( cout &lt;&lt; hex, &quot;&quot; ) );

sendbuffer = str;	//sowas brauch ich
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1764413</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764413</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Fri, 21 Aug 2009 15:42:51 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Fri, 21 Aug 2009 16:43:42 GMT]]></title><description><![CDATA[<ol>
<li></li>
</ol>
<p>Ich vermute mal, in <em>readbuffer</em> befinden sich Zahlenwerte im Bereich 0 - 2^<sup>CHAR_BIT</sup> und zwar ganz unabhängig von irgendeinem Zahlensystem. Du hast also schon ein Bytearray.</p>
<ol start="2">
<li></li>
</ol>
<p>std::basic_string&lt;&gt; bietet die Methode c_str() an, welche ein C-String liefert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1764440</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764440</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Fri, 21 Aug 2009 16:43:42 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Fri, 21 Aug 2009 17:16:19 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// Append a string to stream
void AppendString(const char * str)
{
	LPBYTE stream = (LPBYTE)data;
	stream += size;
	memcpy(stream, str, strlen(str));
	size += (WORD)strlen(str);
	WORD tmpSize = size - 6;
	memcpy(data, &amp;tmpSize, 2);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1764459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1764459</guid><dc:creator><![CDATA[wut]]></dc:creator><pubDate>Fri, 21 Aug 2009 17:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Mon, 24 Aug 2009 07:28:58 GMT]]></title><description><![CDATA[<p>von welchem Typ ist data und size ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1765612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1765612</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Mon, 24 Aug 2009 07:28:58 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Tue, 25 Aug 2009 13:45:06 GMT]]></title><description><![CDATA[<p>woher kommt size in Zeile 5 &quot;stream += size;&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1766464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1766464</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Tue, 25 Aug 2009 13:45:06 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Tue, 25 Aug 2009 14:22:57 GMT]]></title><description><![CDATA[<p>Du brauchst ja nicht den ganzen code von der Funktion.</p>
<pre><code class="language-cpp">LPBYTE stream = (LPBYTE)data;
	memcpy(stream, str, strlen(str));
</code></pre>
<p>Will do the job.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1766488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1766488</guid><dc:creator><![CDATA[do not comprehend]]></dc:creator><pubDate>Tue, 25 Aug 2009 14:22:57 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Tue, 25 Aug 2009 14:24:34 GMT]]></title><description><![CDATA[<p>do not comprehend schrieb:</p>
<blockquote>
<p>Du brauchst ja nicht den ganzen code von der Funktion.</p>
<pre><code class="language-cpp">LPBYTE stream = (LPBYTE)data;
	memcpy(stream, str, strlen(str));
</code></pre>
<p>Will do the job.</p>
</blockquote>
<p>Err, du brauchst nur das memcpy, eine linie zu viel kopiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1766489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1766489</guid><dc:creator><![CDATA[do not comprehend]]></dc:creator><pubDate>Tue, 25 Aug 2009 14:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to string to hex-code to byte array on Wed, 26 Aug 2009 07:35:05 GMT]]></title><description><![CDATA[<p>ok memcpy().</p>
<p>und wie funktioniert das ganze umgekehrt?<br />
Also die ankommenden Daten sind vom Typ LPBYTE und liegen in hex vor.<br />
Wie bekomme ich das in für Menschen lesbaren Klartext?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1766810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1766810</guid><dc:creator><![CDATA[mynamexy]]></dc:creator><pubDate>Wed, 26 Aug 2009 07:35:05 GMT</pubDate></item></channel></rss>