How to embed a file into an executable?

前端 未结 6 1335
一个人的身影
一个人的身影 2020-11-27 18:21

I have a small demo executable wrote in C++ that depends only on one 5kb PNG image being loaded before it can run, which is used for a pixel text I made. Because of this on

6条回答
  •  抹茶落季
    2020-11-27 18:32

    Look at XD:

    http://www.fourmilab.ch/xd/

    Finally, xd can read a binary file and emit a C language data declaration which contains the data from the file. This is handy when you wish to embed binary data within C programs.

    Personally, I'd use resources for windows, but if you require a truly portable way that doesn't involve knowledge of the executable format, this is the way to go. PNG, JPG, whatever...

提交回复
热议问题