Annamalai Gurusami wrote: > Duong Thai Ha wrote: > >> Hi >> >> Thanks a lot >> >> I have tried and there is error. C++ can not convert from char* to const >> char* >> I have to use the const_cast <char*> and it work >> > > Not correct. > > For converting from char* to const char*, no const_cast is required. But > for converting from const char* to char*, const_cast is required. In > the current situation you are doing a conversion from const char* to > char*, and hence the need for const_cast. > > Rgds, > anna > > AND you shouldn't be doing that. the const tells the compiler that you're not going to change things, and you are. In other words, you're lying to the compiler and to all the people reading your code.
[Non-text portions of this message have been removed]
