NH> Your example is C, not C++. The C++ way to do it is to overload the
NH> "=" operator for whatever type you'll be appending (in this case a
NH> character).
You meant the "+=" or the "+" operator, didn't you ?
Bear in mind that the addition of a char to a pointer is *already* defined by
the language. It just doesn't do what he wants. When an integral type (and
char is an integral type) is added to a pointer, the pointer is incremented.
As Darin pointed out, the "C++ way" to add a character to a string is to use
one of the string classes.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|