A read-only data file is read in a C/C++ program.
And I use stdio function such as fopen() to fread() to operate the file.
The content of the data file is constant.
How to build the file into exe file.
I work on MS windows. I use Visual C++ 6.0.
Any suggestions will be appreciated!
Best regards,
Davy
Check your compiler's linker manual to see how to link binary data into your executable. Every linker works differently.
If your linker doesn't provide that feature (shame on it!), then you can use a hex converter utility to convert your data to a large char array (or whatever type is appropriate for your data), and then simply compile it. Maybe like this:
const char mydata[] = {0x35, 0x4F, 0x7C, 0xC1, 0x1D, ...};