您可以使用十六进制一个char **申报数据? [英] can you declare data in a char** using hex?
本文介绍了您可以使用十六进制一个char **申报数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以说我有这个
char *something[] = {
"/bi",
"-c",
"5",
NULL,
NULL
};
但我要声明其十六进制,我将如何做到这一点;编译器不断对我示数出来:
but I want to declare it in hex, how would I do this; compiler keeps erroring out on me:
char *something[] = {
{0x2f,0x62,0x69},
{0x2d,0x63},
{0x35},
{0x00},
{0x00}
};
添加别的东西来此,为0x00始终为空?并始终为0x00转化为对系统NULL其中null是-1例如?
to add something else to this, is 0x00 ALWAYS null? does 0x00 always translate to NULL on systems where NULL is -1 for example?
推荐答案
您可以在字符串中使用十六进制转义序列。例如:
You can use hexadecimal escape sequences within a string literal. For example:
char *something[] = {
"\x2f\x62\x69",
"\x2d\x63"
};
这篇关于您可以使用十六进制一个char **申报数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文