将ATL CString转换为字符数组 [英] Conversion of ATL CString to character array
本文介绍了将ATL CString转换为字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想转换 CString
转换为 char []
。有人告诉我怎么做?
I want to convert a CString
into a char[]
. Some body tell me how to do this?
我的代码如下:
CString strCamIP1 = _T("");
char g_acCameraip[16][17];
strCamIP1 = theApp.GetProfileString(strSection, _T("IP1"), NULL);
g_acCameraip[0] = strCamIP1;
推荐答案
这似乎是沿着正确的线; http://msdn.microsoft.com/en-us/library/awkwbzyc.aspx
This seems to be along the right lines; http://msdn.microsoft.com/en-us/library/awkwbzyc.aspx
CString aCString = "A string";
char myString[256];
strcpy(myString, (LPCTSTR)aString);
在您的情况下将沿着
strcpy(g_acCameraip[0], (LPCTSTR)strCamIP1);
这篇关于将ATL CString转换为字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文