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);