十六进制的数据类型? [英] datatype for Hexadecimal ?

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

问题描述



有人可以帮助我将目标C中的字符串转换为十六进制值吗?

我必须将十六进制值传递给宏.
我有一个像---- 0xfffff
这样的字符串 如何将该字符串转换为十六进制以及采用哪种数据类型?

Hi,

Can anybody help me in converting the string to hex value in OBJECTIVE C?

I have to pass the hex value to a macro.
I have it in string like ---- 0xfffff
How can I convert this string to hex and in what data type?

推荐答案

为此尝试sprintf:

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ [ ^ ]

从十六进制到整数:
将十六进制字符串"转换为整数 [
祝你好运!
Try sprintf for that:

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/[^]

From hex to int:
Convert a "Hex String" to an Integer[^]

By the way: A hexadecimal value is always a kind of representation just like the decimal representation is. The computer internally always uses a binary format because it is, of course, a binary machine.
Also, the data type can be what you see in it:
Example:
Character ''A'' is represented ''65'' as decimal, ''0x41'' as hexadecimal and ''1000001b''. So, depending on how you interpret it (text or represent it in some numeric base) it gets another meaning.

Good luck!


这篇关于十六进制的数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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