locked
SQLite can't set sqlite3_temp_directory RRS feed

  • Question

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

    First, on http://www.sqlite.org/c3ref/temp_directory.html 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 :/

    Friday, November 15, 2013 8:26 PM

All replies

  • Where is the AV? Is sqlite3_temp_directory accessible?

    That code snippet looks correct and works fine in my test (defining sqlite3_temp_directory as char*). From the doc you linked, sqlite3_temp_directory is an extern. Is it defined properly somewhere in your project or linked in from the library?

    If the problem is specific to SQLite you may be better off asking in SQLite forums.

    --Rob

    Saturday, November 16, 2013 2:02 AM
    Moderator
  • I'm not sure what you mean by "AV" 

    sqlite3_temp_directory is an extern defined in the sqlite libraries, so this is a SQLite specific problem. I'll look around for some sqlite forums. 

    Monday, November 18, 2013 4:45 PM