Click to See Complete Forum and Search --> : Getting character string from CString object


vikram deshmukh
May 11th, 1999, 12:55 PM
Hi Gurus ,
I'm having one CString object in which i'm having one string . I want to
concatenate that string with some other string .
Even i've tried with CString::operator LPCTSTR(). But giving error like
unable to convert from "const char*" to "char*".

A code illustrated below ,

strcat(m_FileEdit.operator LPCTSTR(),".bmp");//m_FileEdit is CString object

Moreover i want to convert this string to character string .
Otherwise even it will work, if somebdy tells me how to retrieve string
inside CString object as a character string .

Thanks in advance !

czieler
May 11th, 1999, 01:17 PM
m_FileEdit+=".bmp";
then do a strcpy into a char variable

Dan Haddix
May 12th, 1999, 12:36 AM
I believe you could just use something like this

m_FielEdit += ".bmp";

then if you need a char* string you can use something like this

char* str = m_FileEdit.GetBuffer(-1);

Will Rothwell
May 12th, 1999, 12:53 AM
Hi,

I normally do strcpy(char *Des, (LPCSTR) strSource)

Will