fseek doesn't look working
void myLoadAsset(AAssetManager* mngr){ const char imageFilename[] = "myImage.png"; AAsset* asset = AAssetManager_open(mngr, imageFilename, AASSET_MODE_UNKNOWN); FILE* fp = (FILE*)AAsset_getBuffer(asset); // AAsset_seek(asset, 1000, SEEK_SET); fseek(fp, 1000, SEEK_SET); size_t imageSize = AAsset_getRemainingLength(asset); unsigned char *pImage = (unsigned char*)malloc(sizeof(unsigned char) * imageSize); pImage, fp, imageSize); // AAsset_seek(asset, 0, SEEK_SET); fseek(fp, 0, SEEK_SET); fread(pImage, 1, imageSize, fp); }
the code above doesn't work. it stops at fseek.
when fseek changed to AAsset_seek, it stops at fread.
AAsset_seek correctly adjusts the offset.
I submitted a question on this problem to android ndk developer group.