在数组中包含已编译的C源文件 [英] Including compiled C source file in array

查看:89
本文介绍了在数组中包含已编译的C源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是否可以这样做:


unsigned char arr [] = {

#include" cFile.c"

}


我需要将C源文件cFile.c编译并将其二进制输出转换为

包含在数组中。


我们如何实现它?还有其他技巧吗?


谢谢,

Sachin

解决方案

sachin写道:





是否可以这样做:


unsigned char arr [] = {

#include" cFile.c"

}


我需要将C源文件cFile.c编译并将其二进制输出包含在数组中。


我们如何实现它?还有其他技巧吗?



你可以编译cFile.c并复制它的字节,(如十六进制,十进制或

八进制文本。所有二进制编辑器可以为你显示这个),你的数组

声明。


另外可能还有特定于编译器的扩展,

虽然我对此表示怀疑。您也可以考虑在运行时使用fread加载二进制文件的可能性。


在文章< b6 ** ******** @ u12g2000prd。 googlegroups.com>,

sachin< sb ****** @ rediffmail.comwrote:


>我需要那个C源文件cFile.c编译并将其二进制输出包含在数组中。



您期望用它做什么?


- Richard

-

在紧接着数字9的两个字符的选择中,

应考虑由图形10和11替换为

促进采用纯正货币区域的代码。 (X3.4-1963)


ri **** *@cogsci.ed.ac.uk (理查德托宾)写道:


文章< b6 ********** ************************ @ u12g2000prd。 googlegroups.com>,

sachin< sb ****** @ rediffmail.comwrote:


>>我需要那个C源文件cFile.c要编译并将其二进制输出包含在数组中。



您希望能用它做什么?


- Richard



我希望他有一些基于动态

变量生成代码的东西,并希望有变量记录,例如接受用户调整,

再生记录结构,重新编译记录处理SW,运行记录

处理SW。


Hi,

Is it possible to do something like this:

unsigned char arr[] = {
#include "cFile.c"
}

I need that C source file cFile.c to compile and its binary output to
include in array.

How we can achieve it? Any other trick to do this?

Thanks,
Sachin

解决方案

sachin wrote:

Hi,

Is it possible to do something like this:

unsigned char arr[] = {
#include "cFile.c"
}

I need that C source file cFile.c to compile and its binary output to
include in array.

How we can achieve it? Any other trick to do this?

You can compile cFile.c and copy it''s bytes, (as hexadecimal, decimal or
octal text. All binary editors can show this for you), to your array
declaration.

Alternatively there might be compiler specific extensions for this,
though I doubt it. You might also consider the possibility of loading
the binary file at runtime with fread.


In article <b6**********************************@u12g2000prd. googlegroups.com>,
sachin <sb******@rediffmail.comwrote:

>I need that C source file cFile.c to compile and its binary output to
include in array.

What do you expect to be able to do with it?

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)


ri*****@cogsci.ed.ac.uk (Richard Tobin) writes:

In article <b6**********************************@u12g2000prd. googlegroups.com>,
sachin <sb******@rediffmail.comwrote:

>>I need that C source file cFile.c to compile and its binary output to
include in array.


What do you expect to be able to do with it?

-- Richard

I would expect he has something which produces code based on dynamic
variables and wants to have variable records e.g accept user tweaks,
regenerate record structures, recompile record handling SW, run record
handling SW.


这篇关于在数组中包含已编译的C源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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