Quote:Original post by crazy_andy
neither work :(
there must be a way to do this.
A CEdit box returns a CString, and the inet_addr needs a char *
Is there any other function to replace either of these, to either start with a char[] or use a cstring?
tbh, i don't understand why you're having problems - CString::GetBuffer get buffer will explicitely return an LPCTSTR, so this should be ok as long as UNICODE isn't defined in your project. (like apoch said)
As an alternative to using CString, and at the same time writing unicode/mbcs compliant code to be safe, you could write something like:
TCHAR szHostname[ MAX_BUFFER + 1 ];
m_edtUrl.GetWindowText( szHostname, MAX_BUFFER );
const char* pcHostname( T2CA( szHostname ) );
if ( inet_addr( pcHostname ) == INADDR_NONE )
Assuming that your edit box is called m_edtUrl. i've not tested this, and you might need to include atlconv.h in your pch - but it should explicitely get you a char* in all cases.