Hi 

I really wanted not to use the const_cast. The case that i have to use
it to pass the name of the file that i want to write on. In that case,
then i think it is a const anyway. Hope that i didn't lie too much. :-|
 

--- In [email protected], "Victor A. Wagner Jr." <[EMAIL PROTECTED]> wrote:
>
> 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]
>


Reply via email to