将int转换为十六进制值 [英] convert int to hex value

查看:333
本文介绍了将int转换为十六进制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将int值转换为十六进制值.十六进制值存储在int变量中.
假设我的int = 22;我想将22转换为十六进制值(16-十六进制值22).并且最后16位存储在任何int变量(int b)中.

I want to convert int value into hex value. And hex value is stored in int variable.
suppose I have int a = 22; and i want to convert 22 into hex value(16- hex value of 22). And at the last 16 is stored into any int variable(int b).

推荐答案

变量都在内部存储为二进制,因此如果要查看的值十六进制,纯粹是人类可读的表示形式.

例如:
Variables are all internally stored as binary, so if you want to view a value as hex, its purely a human readable representation.

For example:
int a = 22;
CString hex_a;
hex_a.Format("%X", a); //<-- this will contain hex 16, but only as text


这篇关于将int转换为十六进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆