The Yang solution worked, thanks a lot ; )

Adriano Crestani

On 1/25/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:

Adriano Crestani wrote:
> OK, but when I try to do it:
>
> char* namePtr = (char*) name.c_str;
>
> I get this error message:
>
> Error    36    error C2440: 'type cast' : cannot convert from 'const
char
> *(__thiscall std::basic_string<_Elem,_Traits,_Ax>::* )(void) const' to
> 'char
> *'
>
> I suppose that isn't allowed to cast from const to not const type.
>
> Adriano Crestani
>

Try this:
char* namePtr = (char*) name.c_str();
I added () at the end, your code was trying to convert a pointer to the
name.c_str method to a char* :)

Some C++ compilers may complain with such a cast so you can also try this:
char* namePtr = const_cast<char *>(name.c_str());

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to