UNICODE string to/from ASCII string


//ASCII string to Unicode conversion.

CHAR lpszData1[1024];
WCHAR lpszData2[1024];//Wide char string
DWORD dwSize = sizeof(lpszData2);

strcpy_s(lpszData1, “Hello World”); // ASCII string

MultiByteToWideChar(CP_ACP, 0, LPCSTR(lpszData1), -1, lpszData2, dwSize);
//Unicode to ASCII conversion

CHAR lpszData1[1024]; //ASCII string
WCHAR lpszData2[1024];//Wide char string
WideCharToMultiByte(CP_UTF8, 0, lpszData2, -1, (LPSTR)lpszData1, 1024, 0, 0);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: