I have a char array of 30. How do I convert a CString so I can assign the values to the array? Thanks.
Printable View
I have a char array of 30. How do I convert a CString so I can assign the values to the array? Thanks.
Ah. nevermind found it again. :D
Code:strcpy(MyCharArray,(LPCTSTR) MyCString);
No good way, screws up CString's memory management. Simply do
Code:char ar[30] = "Helloooooojjjjjhhhhhgggggffff";
CString str;
str = ar;
// or
CString str2(ar);
Thanks, but I was looking for something that will do ar = str. strcpy() seems to do it correctly.