TCHAR tchCamIPTemp[15];
_tcscpy(tchCamIPTemp, strCamIP1);
WideCharToMultiByte(CP_ACP, 0, tchCamIPTemp, -1, g_acCameraip[0], sizeof(g_acCameraip[0]), NULL, NULL);
First I convert the CString to TCHAR and then with the help of WideCharToMultiByte method convert the TCHAR data into char.