Conversion of ATL CString to character array

c++, c-strings, char, visual-c++

Solution

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);

which in your case would be along the lines of

strcpy(g_acCameraip[0], (LPCTSTR)strCamIP1);

Problem

I want to convert a `CString` into a `char[]`. Some body tell me how to do this? My code is like this : ``` CString strCamIP1 = _T(""); char g_acCameraip[16][17]; strCamIP1 = theApp.GetProfileString(strSection, _T("IP1"), NULL); g_acCameraip[0] = strCamIP1; ```

Original source