TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: NEIL HELLER
from: JONATHAN DE BOYNE POLLARD
date: 1998-01-22 21:46:00
subject: CHAR TO STRING

 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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.