converting int to hex int

  • Thread starter Thread starter farseer
  • Start date Start date
F

farseer

every example i found shows how to convert an into to a hex STRING.

But what if i have an API that expects and int or byte parameter, but
that parameter is expected to be a hex value?

for instance, i need to convert
int zeroVK_D = 47;
to
int zeroVK_H = 0x2f;

i would like to convert the first (decimal) to the second (hex). they
both represent the same thing, but i need to assign the hex to an int
to pass to an API. How can i do this type of conversion?
 
farseer said:
every example i found shows how to convert an into to a hex STRING.

But what if i have an API that expects and int or byte parameter, but
that parameter is expected to be a hex value?

There's no such thing as a "hex value" or a "decimal value" as far as
an int is concerned - it's just a number.
for instance, i need to convert
int zeroVK_D = 47;
to
int zeroVK_H = 0x2f;

i would like to convert the first (decimal) to the second (hex). they
both represent the same thing, but i need to assign the hex to an int
to pass to an API. How can i do this type of conversion?

There is no conversion required. As you say, they both represent the
same thing - nothing can tell the difference.
 
Back
Top