How can i store files into a binary file? (want to store bmp-wav-txt)

I finished the Win32 C++ GAME_Labyrinth API with DireXt 9
and
I want to gather all .bmp textures, .txt infos and .wav soundtracks
in 3 binaries Music.dat Textures.dat TextInfos.dat

I know to store text into binary file

Can I store generally anything into a binary?

Can i store files into a binary and export them with sompe pointers when needed?

How? Any documenation with our without example code on that?
( would like example code)
You can add any binary file type to the resource file (.rc) for your project. Details on msdn:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa381039(v=vs.85).aspx

To use in the program you use FindResource or FindResourceEx and LoadResource:

http://msdn.microsoft.com/en-us/library/ms648042%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms648046(v=vs.85).aspx
Wait wait wait, so this will just include-pack to the final executable the resource files?

So i will come up with a 30 mb executable. Ok no prob but thats not such professional

What if i want to have .dat files consisting of many diferent size files as resources, as I mentioned before. THere must be a way
You can compress all resources in a zip file and add them to executable as a string buffer with known length. Then extract them at runtime using some zip decompression algorithm and you are done.
Linux ELF format does not have resources, this methods works regarding of the operating system. This also prevent people messing with resource editors too :)

There are cases when this method also lower executable size instead of growing (zip decompression take 40 KB executable size overhead).
You don't have to store it in the executable. You can store resources in a DLL as well. If you don't want to go the WIN32 resource route then there are other options.
Topic archived. No new replies allowed.