Someone in your office wants to know if it can be done?

That's got to be the most hilarious thing I've heard in a long time. And do they have two tufts of pointy hair as well?

Seriously, though .. you need to understand number bases to understand what's going on here. Just telling you that the answer is 63,360 (which it isn't) isn't going to help you.

You need to decompose the number into tens, hundreds and thousands, then remember that in hexadecimal, ten is actually 16, a hundred is actually 256 and a thousand is actually 4,096. So then it's 9 x 4,096 plus .. you get the idea.

Alternatively, you could convert 0x9210 to binary, giving 1001 0010 0001 0000, then just multiplying by the appropriate powers of two. Actually, that looks pretty easy .. 16,384 + 4096 .. well, you get the idea.

Alternatively, in C you could sscanf the number in using "%x", then print it out using "%d" and get the machine do to the conversion.

The Windows calculator application also converts between hex and decimal.

So, anyway, good luck.

--t. alex

"Excellent. Release the hounds." -- Monty Burns.


In reply to Re: Re: Re: Convert hex to string by talexb
in thread Convert hex to string by Ras

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.