?
新建一个文件:hello.txt,其内容为"Hello world!!",
?
?
然后将 这些字符所对应的asc 码数值写到hello.hex文件中
?
?
写Testbed 测试:
#include
#include
?
char hex[] = {
?#include "hello.hex"
};
int main()
{
?printf("%s", hex);
?system("pause");
?return 0;
}
?
?
如果不转化成 asc码,如果想输出字符,把文件中的字符串加上“”即 "Hello World!!"。
?
看到这里,对include 有了更深刻更清晰的理解,它在编译之前进行预处理,是负责将其link 到的文件,导入到改文件中(头文件也一样),这么做的本质原因,是为了让高级语言更加好维护,结构更加清晰
?
char hex[] = {
?#include "hello.hex"
};
?
等同于
char hex[] = {
?0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x21, 0x0D, 0x0A
};
?
