Jump to content
Tuts 4 You

Hexidecimal to Decimal


zorke

Recommended Posts

Posted

Hi :)

Recently i've started a project which requires displaying output as a decimal number in ASCII characters.

I've done the Hex value - to - ascii char thing but conversion of the number ... say - 2012 from hex (which is 0x07dc)

to a decimal number displayed on the screen (2012) is a bit more difficult.

Example : eax == 07dc i want to display in a messagebox the decimal value of eax. how do i make it decimal?

Thanks

Posted

What language are you coding this in?

Posted (edited)

Here is a function of me coded for Delphi performing that task, I hope it could be helpful:

function IntegerToString(Quantity: Int64): String;
var
Remainder: Integer;
begin
Result := '';
Repeat
Remainder := Quantity MOD 10;
Result := Chr(Remainder + Ord('0')) + Result;
Quantity := Quantity DIV 10;
until Quantity = 0;
end;
Edited by Nacho_dj
Posted

masm32\help\masmlib\Conversions

all functions as sources masm32\m32lib

Posted

also, check the winapis printf/sprintf/wsprintf.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...