0
点赞
收藏
分享

微信扫一扫

From CString to char * in C++ with unicode setting

DT_M 2022-08-22 阅读 159


//convert from CString to char *, first from CString to wchar_t* then to char *
wchar_t* wCharString = sFile.GetBuffer(sFile.GetLength()+1); //CString to wchar_t*
size_t origsize = wcslen(wCharString) + 1;
size_t convertedChars = 0;

char gszFile[100] = {0};

wcstombs_s(&convertedChars, gszFile, origsize, wCharString , _TRUNCATE); //from wchar_t* to char*


from Hex String to decimal

wchar_t *end = NULL;
long value = wcstol(resp, &end, 16);


sw.Format(_T("%d"),value);

举报

相关推荐

0 条评论