<?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 zu DWORD convertieren (die zeichen, nicht den ASCII code)]]></title><description><![CDATA[<p>Also ich habe das Problem, dass ich einen wert wie diesen &quot;CD270000&quot; auf einem string gespeichert habe, es soll einen HEX wert (DWORD) darstellen, und ich muss es in ein DWORD convertieren um damit weiterrechnen zu können.<br />
Mich intressieren dabei NICHT der ASCII code (wie es am pc gespeichert ist) sondern das was das menschliche Auge hier zu sieht.</p>
<pre><code>// d.h wenn ich z.b. habe:
string ich_will_hex(&quot;CD27FEA0&quot;);

// will ich...
DWORD hier_in_hex = StringToDword(ich_will_hex);

// hier_in_hex sollte dabei den wert: 0xCD27FEA0 annehmen!

// habe folgendes probiert
DWORD CharToDword(const char * text_hex)
{
	DWORD ret=0x00000000;

	char hex_symbols[]={'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
	DWORD adder[]={0x0FFFFFFF, 0x00FFFFFF, 0x000FFFFF, 0x0000FFFF, 0x00000FFF, 0x000000FF, 0x0000000F, 0x00000000};
	for(int j=0; j&lt;8; j++)
	{
		for(int i=0; i&lt;16; i++)
		{
			if(hex_symbols[i] == text_hex[j])
			{
				ret += (i + adder[i];
			}
		}
	}
	return ret;
}

DWORD iam_hexxxx = CharToDword(&quot;F2CE5678&quot;);

//dabei kommt aber nur schrott raus ^,^
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/220356/string-zu-dword-convertieren-die-zeichen-nicht-den-ascii-code</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 09:55:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/220356.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Aug 2008 01:11:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String zu DWORD convertieren (die zeichen, nicht den ASCII code) on Fri, 15 Aug 2008 01:11:50 GMT]]></title><description><![CDATA[<p>Also ich habe das Problem, dass ich einen wert wie diesen &quot;CD270000&quot; auf einem string gespeichert habe, es soll einen HEX wert (DWORD) darstellen, und ich muss es in ein DWORD convertieren um damit weiterrechnen zu können.<br />
Mich intressieren dabei NICHT der ASCII code (wie es am pc gespeichert ist) sondern das was das menschliche Auge hier zu sieht.</p>
<pre><code>// d.h wenn ich z.b. habe:
string ich_will_hex(&quot;CD27FEA0&quot;);

// will ich...
DWORD hier_in_hex = StringToDword(ich_will_hex);

// hier_in_hex sollte dabei den wert: 0xCD27FEA0 annehmen!

// habe folgendes probiert
DWORD CharToDword(const char * text_hex)
{
	DWORD ret=0x00000000;

	char hex_symbols[]={'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
	DWORD adder[]={0x0FFFFFFF, 0x00FFFFFF, 0x000FFFFF, 0x0000FFFF, 0x00000FFF, 0x000000FF, 0x0000000F, 0x00000000};
	for(int j=0; j&lt;8; j++)
	{
		for(int i=0; i&lt;16; i++)
		{
			if(hex_symbols[i] == text_hex[j])
			{
				ret += (i + adder[i];
			}
		}
	}
	return ret;
}

DWORD iam_hexxxx = CharToDword(&quot;F2CE5678&quot;);

//dabei kommt aber nur schrott raus ^,^
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1565105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565105</guid><dc:creator><![CDATA[kjartan]]></dc:creator><pubDate>Fri, 15 Aug 2008 01:11:50 GMT</pubDate></item><item><title><![CDATA[Reply to String zu DWORD convertieren (die zeichen, nicht den ASCII code) on Fri, 15 Aug 2008 02:53:14 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-213350-and-highlight-is-string+hex+konvertieren.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-213350-and-highlight-is-string+hex+konvertieren.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565112</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565112</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Fri, 15 Aug 2008 02:53:14 GMT</pubDate></item></channel></rss>