C++ string best practices => LPTSTR, PSTR, CString, _T, TEXT, Win32 API, Win16. string, wstring.
strings
http://msdn.microsoft.com/en-us/library/ms174288.aspx
LPTSTR
http://baike.baidu.com/view/3186101.htm
Using CString very useful
http://msdn.microsoft.com/en-us/library/ms174288.aspx
CryptStringToBinary <=> CryptBinaryToString
// CString_example_1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> #include <tchar.h> #include <windows.h> #include <string> #include <wincrypt.h> #include <iostream> // std::cout, std::end #pragma comment(lib, "crypt32.lib") int _tmain(int argc, _TCHAR* argv[]) { // Chinese characters for "zhongwen" ("Chinese language"). const BYTE kChineseSampleText[] = { -28, -72, -83, -26, -106, -121, 0 }; //-28 => 1110,0100 => 228 //-72 => 1011,1000 => 184 //-83 => 1010,1101 => 173 //-26 => 1110,0110 => 230 //-106 => 1001,0110 => 150 //-121 => 1000,0111 => 135 //const char kChineseSampleText[] = "xe4xb8xadxe6x96x87"; //const char kChineseSampleText[] = "e48ade69687"; DWORD strLen = 0; CryptBinaryToString(kChineseSampleText, 6, CRYPT_STRING_HEXRAW, NULL, &strLen ); LPTSTR string1 = new TCHAR[strLen + 1]; CryptBinaryToString(kChineseSampleText, 6, CRYPT_STRING_HEXRAW, string1, &strLen ); string1[strLen] = '