MFC CString转int、double、TCHAR*类型

MFC CString转int、double、char类型

//CString转int CString szPort = L"2589"; int nPort = _ttoi(szPort); //CString转double CString szPort = L"2589.00"; double nPort = _ttol(szPort); //其它类型转CString int nPort = 2589; char ip[32] = "这样啊"; CString str;str.Empty(); str.Format(_T("%d:%s"), nPort, ip); //CString转TCHAR* CString cstr(L"hello"); TCHAR *pstr = cstr.GetBuffer(str);

 

char 与 wchar_t

/*---------------------------------------- File: mr.h 使用宏定义同函数名可以避免修改编译器编译环境 -----------------------------------------*/ #pragma once #ifndef MR_H #define MR_H #ifdef UNICODE #define _mrstrncpy wcsncpy #define _mrstrcpy wcscpy #define _mrstrlen wcslen #define _mrstrcat wcscat #define _mrstrcmp wcscmp #else #define _mrstrncpy strncpy #define _mrstrcpy strcpy #define _mrstrlen strlen #define _mrstrcat strcat #define _mrstrcmp strcmp #endif #endif

你可能感兴趣的:(编译链接错误)