我在WinRT C ++应用程序中开始使用SQLite,我遇到了一些问题。
首先,在http://www.sqlite.org/c3ref/temp_directory.html上,它表示您必须使用以下代码设置sqlite_temp_directory:
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;
当我尝试运行此代码时,最后一行会导致内存访问冲突。