12/07/2016

convert tchar * to char * / char * to tchar*

tchar* -> char*

"Tch" is tchar*
"pStrTch" is char*


TCHAR Tch[MAX_PATH + 1];
int lenOftch = (wcslen(Tch) + 1) * 2;
char * pStrTch = (char*)malloc(sizeof(char)*MAX_PATH);

//tchar* to char*
WideCharToMultiByte(CP_UTF8, 0, Tch, -1, pStrTch, lenOftch, NULL, NULL);
//


char* -> tchar*


char charBuff[]="test";
TCHAR szUniCode[256]={0,};
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, charBuff, strlen(charBuff), szUniCode, 256);

No comments:

Post a Comment