
convert char to const char
Quote:
> Dear all ,
> i am new to this can u help in converting the following
> char *apts
> const char *aptx
const char *pc=const_cast<const char *> (aptx);
Note that this cast is rarely needed, as non-const arguments
automatically become const when passed to a function requiring const
parameters. You may use it, however, to document your intention.
Quote:
> how can i do that...
> 2ndly how can i copy
> strcpy(emprs.first, &apts) // this gives error how can i convert this
You're getting an error because you pass the address of aptx, which is
already a pointer. &aptx is of type char **, which is not what this
function expects. Simply pass aptx as is, without the ampersand:
strcpy(emprs.first, apts);
Danny Kalev
"The ANSI/ISO C++ Professional Programmer's Handbook"
http://www.amazon.com/exec/obidos/ASIN/0789720221