wince编程CString2Char

在写代码过程中,经常需要把CString类型数据转换成CHAR*(CAHR[])型的。

在网上有很多种方法实现这种转换,但本人还是喜欢用WideCharToMultiByte。

void CString2Char(CString csIn,CHAR *ucOut,int nOutLen)

{

WideCharToMultiByte(CP_ACP,NULL,csIn,_tcslen(csIn),ucOut,nOutLen,NULL,FALSE);

}

函数原型:int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPWSTR lpWideCharStr, int cchWideChar, LPCSTR lpMultiByteStr, int cchMultiByte, LPCSTR lpDefaultChar, PBOOL pfUsedDefaultChar );


posted on 2011-09-23 12:54  and_tt  阅读(458)  评论(0编辑  收藏  举报

导航