我用MultiByteToWideChar怎么转都是乱码,但用CString来进行过度一下就行了靠,这是怎么回事?原理是什么?求教育
解决方案 »
- 请问LPVIDEOHDR->lpData取摄像头的视频帧的数据是什么类型的
- VC下怎么才能判断哪个分区是系统分区? 如果在C、D分区都装了操作系统,怎么才能知道当前系统是从那个分区启动的?
- UDP 协议可以走 Http 隧道吗?
- 关于编译时的一个问题。在线等。
- ——*-简单CString的长度问题,在线给分-*——
- 请问怎样实现文本的朗读????? thank you !
- 如何将字符串"20.0E6"转换为数字?
- GeoMedia 谁有这个软件的中文帮助,我要中文的。解决了要多少分,我给多少。
- 交友,关于VC编程的!!
- 急!急!!急!!!真的需要你们帮个忙。能给的分就这么多了。非常感谢。关于word2000 file format
- 不自绘如何改变checkbox后面的文字颜色
- 使用wininet post网页数据
// from a UNICODE string (converts to TCHAR)
CString(LPCWSTR lpsz);
// subset of characters from an ANSI string (converts to TCHAR)
CString(LPCSTR lpch, int nLength);
// subset of characters from a UNICODE string (converts to TCHAR)
CString(LPCWSTR lpch, int nLength);
// from unsigned characters
CString(const unsigned char* psz);
{
int widecharLen = ::WideCharToMultiByte(CP_ACP, 0, szWidechar, -1, NULL, 0, NULL, NULL);
char* pAnsi = new char[widecharLen+1];
memset(pAnsi, 0x00, widecharLen+1);
::WideCharToMultiByte(CP_ACP, 0, szWidechar, -1, pAnsi, widecharLen, NULL, NULL); return pAnsi;
}
std::string WString2String(const std::wstring& wstr)
{
std::string strTmp(WideCharToANSI(wstr.c_str()));
return strTmp;
}
{
int widecharLen = ::WideCharToMultiByte(CP_ACP, 0, szWidechar, -1, NULL, 0, NULL, NULL);
char* pAnsi = new char[widecharLen+1];
memset(pAnsi, 0x00, widecharLen+1);
::WideCharToMultiByte(CP_ACP, 0, szWidechar, -1, pAnsi, widecharLen, NULL, NULL); return pAnsi;
}
std::string WString2String(const std::wstring& wstr)
{
std::string strTmp(WideCharToANSI(wstr.c_str()));
return strTmp;
}