MFC Unicode 到 ansi 的转换

来源:互联网 发布:mc9s12x 串口编程 编辑:程序博客网 时间:2024/05/17 02:56

定义变量

char *szbuff = "三翻四复第三方斯蒂芬";

char szbuff1[1024] = {0};

TCHAR *szbuffT = _T("三翻四复第三方斯蒂芬");

TCHAR szbuffT1[1024] = {0};

ANSI 到 unicode

USES_CONVERSION;
_tcscpy_s(szbuffT1, _countof(szbuffT1), A2W(szbuff));
strcpy_s(szbuff1, _countof(szbuff1), W2A(szbuffT));

unicode 到ANSI
      _tcscpy_s(szbuffT1, _countof(szbuffT1), CA2W(szbuff));
      strcpy_s(szbuff1, _countof(szbuff1), CW2A(szbuffT));

原创粉丝点击