MFC编程中与编码方式有关的宏定义的使用

2021/5/31 12:25:19

本文主要是介绍MFC编程中与编码方式有关的宏定义的使用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1

多字节字符集:char *strcpy(char *strDestination, const char *strSource);  

Unicode字符集:wchar_t *wcscpy(wchar_t *strDestination, const wchar_t *strSource); 

通用:_tcscpy

#ifdef  UNICODE   
    #define _tcscpy     wcscpy  
#else  
    #define _tcscpy     strcpy  
#endif

2

CString String2CString(std::string str)
{

CString cstr;
cstr = CA2T(str.c_str());//CA2T是与编码方式有关的宏定义
return cstr;
}


std::string CString2String(CString cstr)
{
std::string str;
str = CT2A((LPCTSTR)cstr);//CT2A是与编码方式有关的宏定义
return str;
}

 



这篇关于MFC编程中与编码方式有关的宏定义的使用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程