I'm trying to generate file content in the memory and use it in Irrlicht Engine without creating temporary files on the disk at runtime. So for testing i have created device and wrote next code:
Code: Select all
char* m = new char[4];
m[0] = 'A';
m[1] = 'B';
m[2] = 'C';
m[3] = 'D';
IReadFile* f = device->getFileSystem()->createMemoryReadFile(
m, // buffer
4, // length
"myfile.tmp",
true /* this should delete my m on drop */);
// ... do some/nothing here ...
f->drop(); // i do drop() here,
// since i have created object using "create" method,
// and also because the doc says "The returned pointer should be dropped when no longer needed."So what is wrong in my code, and how to use createMemoryReadFile() with deleteMemoryWhenDropped==true ?