We can use the windows API WideCharToMultiByte()transfer to each other.
The code is as fellows:
#ifdef _UNICODE char pstrService[HOSTNAME_SIZE]; WideCharToMultiByte(CP_ACP, 0, pstrService, -1, strServiceName, sizeof(pstrService), NULL, NULL ); #else WCHAR pstrService[MAX_PATH] = {0}; MultiByteToWideChar(CP_ACP, 0, (LPCSTR)cstrText.GetBuffer(), -1, pstrService, sizeof(pstrService)); #endif |