Question : convertin CString to const char*

What are some ways to convert a CString to a const char*.
What makes one way better than another?

Answer : convertin CString to const char*

CString str ( "test")

char* p = ( LPCTSTR) str; //uses CString::operator ( LPCTSTR);

char* p = str.GetBuffer ( 0);

The 1st one is faster, it just returns CString::m_pchData, whereas the 2nd one does some validation
Random Solutions  
 
programming4us programming4us