Examples‎ > ‎

Fossilizing a file

To fossilize a file means to embed any file inside the source code but being visible from the File System. It is very useful for adding "built in configurations", logos, ...

The first step is to convert our file to C source code using:

fossilize logo.bmp

It will generate the file logo_bmp.c that we must include in our project. And finally, we include it in the ROM media directory.

extern const ROM_FILE romLogo_bmp;

const ROM_FILE* romFileTable[] =
{
&romLogo_bmp,
};

Once the file is in our File System, we can access to it. Keep in mind that these files are read only.

EFILE* pMyLogo = efOpen("rom/logo.bmp", "r");
if (pMyLogo!=NULL)
{
VOID* pMyData;
INT nDataLen;

while ((nDataLen=efGet(pMyLogo, &pMyData))>0)     // Special API function to get data from
                                                  // memory files with zero copy
{
//  To do something with the data in pMyData
}
efClose(pMyLogo);
}



Comments