mardi 13 octobre 2015

SQLite can't set sqlite3_temp_directory with WinRT

I'm getting started with SQLite in my WinRT C++ application and I'm having a few problems.

First, on http://ift.tt/1rY7JLK it says that you have to set up the sqlite_temp_directory with the following code:

LPCWSTR zTempPath = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data();      

char zTempPathBuf[MAX_PATH + 1];        

memset(zTempPathBuf, 0, sizeof(zTempPathBuf));      

WideCharToMultiByte(CP_UTF8, 0, zTempPath, -1, zTempPathBuf, sizeof(zTempPathBuf), NULL, NULL); 

sqlite3_temp_directory = zTempPathBuf;

When I try to run this code, the last line causes a memory access violation.

Aucun commentaire:

Enregistrer un commentaire