Hi
I'm writing a class to act as a wrapper around a C library.
This C library exposes functions like:
SetSomeInfo( char *pTheInfo );
In my wrapper class, the info in question is in a STL string.
std::string m_TheInfo;
So inside the wrapper class I would like to call:
SetSomeInfo( m_TheInfo.c_str() );
But, problem:
c_str returns a const char *, and SetSomeInfo accepts a char * (not
const), so it doesn't compile. Maybe SetSomeInfo is poorly written,
because it should have const in its signature, but it's not mine and
I have no control over it.
So my (rather ugly) workaround right now is:
char *p = (char *)(DWORD) m_TheInfo.c_str() ; //get rid of const
but surely there has to be a more standard way ?
Thanks