Hack Forums
[C] File inside a executable? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] File inside a executable? (/showthread.php?tid=5100621)



File inside a executable? - Hoodie+ - Dec 19, 2015

Hello everyone.
I am wondering is there a way so I can put for example "test.txt" file inside my executable so that I can access it later with fopen()?

Hopefully I explained well.

Thank you! 🤝


* - RISC - Dec 19, 2015

Contents inside test.txt would be nothing more than binary data which notepad interprets.
Yes, you can store the contents of test.txt inside your application. But you can not put the actual "test.txt" file inside your application. You have to understand, it's all just binary information.
When you call fopen, you will simply name it test.txt, and write the contents back into a file.


* - Dickyb0bSue - Dec 19, 2015

yes you can, write to the end of the .exe , then use fread at position filesize + bytes written


* - Mouse❤️ - Dec 19, 2015

http://stackoverflow.com/questions/2933295/embed-text-file-in-a-resource-in-a-native-windows-application There you go.


* - Russ. - Dec 20, 2015

(Dec 19, 2015 09:57 PM)Μouse Wrote:  http://stackoverflow.com/questions/2933295/embed-text-file-in-a-resource-in-a-native-windows-application There you go.

Lemme guess under 1 minute to use google and find an answer?


* - Mouse❤️ - Dec 20, 2015

(Dec 20, 2015 12:25 AM)Dr.Watson Wrote:  Lemme guess under 1 minute to use google and find an answer?
7 seconds if you include the typing time.