<?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[eine Hex zahl in Int umrechnen]]></title><description><![CDATA[<p>Hallo</p>
<p>hab viel gegooglet, und auch die Forensuche benutzt, aber nichts dazu gefunden.<br />
ich habe in einem CString eine Hexzahl stehen. Gibt es eine Möglichkeit aus dieser Hexzahl im cString eine Int-zahl zu machen??</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/118400/eine-hex-zahl-in-int-umrechnen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 10:26:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/118400.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Aug 2005 06:10:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to eine Hex zahl in Int umrechnen on Thu, 18 Aug 2005 06:10:39 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>hab viel gegooglet, und auch die Forensuche benutzt, aber nichts dazu gefunden.<br />
ich habe in einem CString eine Hexzahl stehen. Gibt es eine Möglichkeit aus dieser Hexzahl im cString eine Int-zahl zu machen??</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/854589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/854589</guid><dc:creator><![CDATA[newuser2]]></dc:creator><pubDate>Thu, 18 Aug 2005 06:10:39 GMT</pubDate></item><item><title><![CDATA[Reply to eine Hex zahl in Int umrechnen on Thu, 18 Aug 2005 07:06:07 GMT]]></title><description><![CDATA[<p>Schau dir strtol(..) an.<br />
Es gibt sicher auch noch Möglichkeiten mit stringstreams.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/854612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/854612</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Thu, 18 Aug 2005 07:06:07 GMT</pubDate></item><item><title><![CDATA[Reply to eine Hex zahl in Int umrechnen on Thu, 18 Aug 2005 07:24:07 GMT]]></title><description><![CDATA[<p>Das du viel gegoogelt hast ist aber gelogen oder? Erster Treffer:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;malloc.h&gt;
#include &lt;Afx.h&gt;

int _httoi(const TCHAR *value)
{
  struct CHexMap
  {
    TCHAR chr;
    int value;
  };

  const int HexMapL = 16;
  CHexMap HexMap[HexMapL] =
  {
    {'0', 0}, {'1', 1},
    {'2', 2}, {'3', 3},
    {'4', 4}, {'5', 5},
    {'6', 6}, {'7', 7},
    {'8', 8}, {'9', 9},
    {'A', 10}, {'B', 11},
    {'C', 12}, {'D', 13},
    {'E', 14}, {'F', 15}
  };

  TCHAR *mstr = _tcsupr(_tcsdup(value));
  TCHAR *s = mstr;
  int result = 0;
  if (*s == '0' &amp;&amp; *(s + 1) == 'X') s += 2;
  bool firsttime = true;
  while (*s != '\0')
  {
    bool found = false;
    for (int i = 0; i &lt; HexMapL; i++)
    {
      if (*s == HexMap[i].chr)
      {
        if (!firsttime) result &lt;&lt;= 4;
        result |= HexMap[i].value;
        found = true;
        break;
      }
    }
    if (!found) break;
    s++;
    firsttime = false;
  }
  free(mstr);
  return result;
}

int main(int argc, char* argv[])
{
  CString myString (&quot;0xFFFF&quot;);
  _tprintf(_T(&quot;Hex String: %s is int: %d\n\r&quot;), myString, _httoi(myString));
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/854627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/854627</guid><dc:creator><![CDATA[asdrubael]]></dc:creator><pubDate>Thu, 18 Aug 2005 07:24:07 GMT</pubDate></item><item><title><![CDATA[Reply to eine Hex zahl in Int umrechnen on Thu, 18 Aug 2005 07:26:56 GMT]]></title><description><![CDATA[<p>asdrubael schrieb:</p>
<blockquote>
<p>Das du viel gegoogelt hast ist aber gelogen oder?</p>
</blockquote>
<p>sry aber sowas lass ich mir ned unterstellen...<br />
cya</p>
]]></description><link>https://www.c-plusplus.net/forum/post/854628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/854628</guid><dc:creator><![CDATA[newuser2]]></dc:creator><pubDate>Thu, 18 Aug 2005 07:26:56 GMT</pubDate></item><item><title><![CDATA[Reply to eine Hex zahl in Int umrechnen on Thu, 18 Aug 2005 07:32:28 GMT]]></title><description><![CDATA[<p>ZuK schrieb:</p>
<blockquote>
<p>Schau dir strtol(..) an.</p>
</blockquote>
<p>Danke für deine freundliche Hilfe. Mit strtol(...) funktioniert es.<br />
Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/854630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/854630</guid><dc:creator><![CDATA[newuser2]]></dc:creator><pubDate>Thu, 18 Aug 2005 07:32:28 GMT</pubDate></item></channel></rss>