将任何文件嵌入gcc编译程序并在程序内部访问它

问题描述 投票:0回答:1

我正在制作一个要在文件中读取的程序,并将文件的内容存储到实际程序中。然后,该程序一旦运行,便可以使用嵌入其中的文件制作一个新文件。

Program.c compile with picture.jpg
Program is now the output file that has picture.jpg inside of it
Program runs and then creates a new file called pic.jpg
Program reads somewhere(?) in its own code to find the data of the picture.jpg
Program writes the data to pic.jpg
Now pic.jpg and picture.jpg are the same file.

我做了一些阅读,发现了一篇解释它的小文章:https://codeplea.com/embedding-files-in-c-programs

朝“替代方法-直接链接Blob”的底部>

我的问题是,怎么做

extern const char binary_some_file_jpg_start[];
extern const char binary_some_file_jpg_end[];

告诉我我的数据在哪里?可能是那些随机名称,但它仍然知道在哪里查找数据吗?

我正在制作一个要在文件中读取的程序,并将文件的内容存储到实际程序中。然后,程序一旦运行,便可以使用...

c unix gcc ld
1个回答
0
投票

已经读了这篇文章(这不是必需的;您的问题应该独立存在),对我来说不清楚如何确定数组。文章使用

© www.soinside.com 2019 - 2024. All rights reserved.