C++技巧(寬字符的CString轉換爲constchar*)

C++技巧(寬字符的CString轉換爲constchar*),第1張

C++技巧(寬字符的CString轉換爲constchar*),第2張

I.
使用function _ TCS cpy _ s:
c string字符串("這是一個測試");
int size of string =(the string。GetLength() 1);
LPTSTR lpsz =新TCHAR[sizeof string];
_tcscpy_s(lpsz,sizeOfString,the string);
最後,在UNICODE環境下編譯lpsz爲const類型的
LPTSTR。大提示是whca_t type
II,
CString str = _ t(" Hello world!");
char sztr[256]= { 0 };
wcstombs(sztr,Str,str。GetLength());
const char * p = sztr;

位律師廻複

生活常識_百科知識_各類知識大全»C++技巧(寬字符的CString轉換爲constchar*)

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情