Open houguohua opened 11 years ago
On Android, resources are stored in .apk file, which is zip file. Then you can not use fopen.
On Android,we can write the file from .apk file into data/data directory.
If the resource is not in apk file, you can use fopen by yourself. You can use CCFileUtils::fullPathForFileName() to get full path of a file name, then you can pass the full path to fopen().
I need get the file pointer from the CCFileUtils. Because sometimes,I need only a small part info from a large file. If the CCFileUtils class provides this interface,It can save mush memory. eg, FILE* CCFileUtils::openFile(const char* path, const char* mode) // Open the bundle FILE* fp = CCFileUtils::openFile(path, "rb"); if (!fp) {
WARN_VARG("Failed to open file: '%s'.", path); return NULL; }