sqlite数据库支持中文路径问题

char *unicodetoUtf8(const WCHAR *zWideFilename){
int nByte;
char *zFilename;

nByte = WideCharToMultiByte(CP_UTF8,zWideFilename,-1,0);
zFilename = (char*)malloc( nByte );
if( zFilename==0 ){
return 0;
}
nByte = WideCharToMultiByte(CP_UTF8,zFilename,nByte,
0,0);
if( nByte == 0 ){
free(zFilename);
zFilename = 0;
}
return zFilename;
}

WCHAR *mbcsToUnicode(const char *zFilename){
int nByte;
WCHAR *zMbcsFilename;
int codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;

nByte = MultiBytetoWideChar(codepage,NULL,0)*sizeof(WCHAR);
zMbcsFilename = (WCHAR*)malloc( nByte*sizeof(zMbcsFilename[0]) );
if( zMbcsFilename==0 ){
return 0;
}
nByte = MultiBytetoWideChar(codepage,zMbcsFilename,nByte);
if( nByte==0 ){
free(zMbcsFilename);
zMbcsFilename = 0;
}
return zMbcsFilename;
}

char szPath[256] = "D://Project//Test//wwtest//DBTest//DBTest//我的数据库//pic.db"; char *pPath; WCHAR *wcPath; wcPath = mbcsToUnicode(szPath); pPath = unicodetoUtf8(wcPath); sqlite3_open(pPath,&db);

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能