Hello I have this code but can’t open database:
int result;
sqlite3 db = NULL;
std::string sqlstr;
CCFileUtilsfileUtils = CCFileUtils::sharedFileUtils();
std::string writablePath = fileUtils->getWritablePath();
const char *fileName =“hpc_db.sqlite”;
writablePath.append(fileName);
CCLog(“%s”, writablePath.c_str());
result = sqlite3_open(writablePath.c_str(),&db);
if( result != SQLITE_OK )
{
CCLog(“DB Opened”);
}
else
{
CCLog(“OPENING WRONG”);;
}
sqlite3_close(db);
I think the problem is I didn’t write db file to writablepath. Can someone share some code on how to do that?