首页 > 解决方案 > 如何将带有机器代码的文件存储到数组中

问题描述

我将如何存储任何类型的带有文本 ex 的文件。sasm,mach(用于机器代码)等。我不想像这样写并将它直接放入数组https://ttm.sh/hPS.png 我希望能够从文件中获取文本像这样的文字

0x1000
0x30C3
0x11FC

并将其存储到数组 program[] 中,并将新行作为数组中的新点

标签: cvirtual-machine

解决方案


怎么样:

unsigned program[] = {
#include "program.mach"
};

与 program.mach 看起来像:

0x1000,
0x30C3,
0x11FC

推荐阅读