Pelles C forum
C language => Beginner questions => Topic started by: sp00n on May 01, 2007, 10:01:56 AM
-
I need to keep a binary data(near 3Mb) inside my exe-file. How can I do it in Pelles C?
P.S. data is just binary file, no bitmap, no text, no any known format:)
-
Try using RCDATA in the .RC file
2 RCDATA "data.dat"
John
-
Thanks a lot
And next noob question: How can I work with this resource(reading/writing)? Or must I use the WizWriteFileFromResource function?
-
Or put it into object.
http://www.smorgasbordet.com/forum/index.php?topic=1121.0 (http://www.smorgasbordet.com/forum/index.php?topic=1121.0)
-
Thanks a lot
And next noob question: How can I work with this resource(reading/writing)? Or must I use the WizWriteFileFromResource function?
I expect you could use WizWriteFileFromResource() but if not look at these API's
HRSRC hRes = FindResource(hInst, name, RT_RCDATA);
DWORD dwResSize = SizeofResource(hInst, hRes);
HGLOBAL hResGlobal = LoadResource(hInst, hRes);
LPVOID lpResMem = LockResource(hResGlobal);
You should check the return values of course.
John
-
Or put it into object.
http://www.smorgasbordet.com/forum/index.php?topic=1121.0 (http://www.smorgasbordet.com/forum/index.php?topic=1121.0)
Is it work on PocketPC? Cause I have a linker error about Invalid machine type ;)
-
Thanks a lot
And next noob question: How can I work with this resource(reading/writing)? Or must I use the WizWriteFileFromResource function?
I expect you could use WizWriteFileFromResource() but if not look at these API's
HRSRC hRes = FindResource(hInst, name, RT_RCDATA);
DWORD dwResSize = SizeofResource(hInst, hRes);
HGLOBAL hResGlobal = LoadResource(hInst, hRes);
LPVOID lpResMem = LockResource(hResGlobal);
Thanks John. It working well.
-
Is it work on PocketPC? Cause I have a linker error about Invalid machine type
No, there was machine type IMAGE_FILE_MACHINE_I386 .
In File2Obj1.zip have changed ifh.Machine = IMAGE_FILE_MACHINE_UNKNOWN .
Perhaps this works with PocketPC.
-
I need to keep a binary data(near 3Mb) inside my exe-file. How can I do it in Pelles C?
P.S. data is just binary file, no bitmap, no text, no any known format:)
sp00n,
You can use a binary to MS COFF object module converter to embed binary data in your executable.
-
Google 'bin2coff tool'
Nice command line tool.
-
Thanks to all.
Topic closed:)