How can I load the library after some custom operations?

How can I load the library after some custom operations?
0.0 0


I have a sqlite file in the assets folder. I need to copy this db file to the folder @ data/data/
which is get by @ CCFileUtils::sharedFileUtils()->getWriteablePath()@ (thus,i can read the db file in C++ code)
I do like this in
protected void onCreate(Bundle savedInstanceState) {
context = this;
//copy files from assets to target folder
static {
there is a problem:sometimes library loaded but file may not be copied,How can I load the library after copy files?


Resolved !
sqlite3 pDB = NULL;
errMsg = NULL;
std::string sqlstr;
int result;
string szResPath(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(“millionschool.sqlite”));
string dbPath = CCFileUtils::sharedFileUtils()->getWriteablePath();
unsigned long tmpSize;
unsigned char* dbData = CCFileUtils::sharedFileUtils()->getFileData(szResPath.c_str(), “rb”, &tmpSize);
FILE *fp = fopen(dbPath.c_str(), “wb”);
fwrite(dbData, tmpSize, 1, fp);
result = sqlite3_open(dbPath.c_str(), &pDB);
if( result != SQLITE_OK ){
CCLog( “打開資料庫失敗,錯誤碼:d ,錯誤原因:s\n” , result, errMsg );
CCLog( “打開資料庫成功!” );