TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: TOM TORFS
from: ROGER SCUDDER
date: 1998-01-24 10:10:00
subject: char to string

Hello Tom.
22 Jan 98 17:58, Tom Torfs wrote to Roger Scudder:
EL>> strcat(stringvar, &charvar);
RS>>  Very nice solution!  I can't understand why I never see
RS>>  anyone using it.
TT> Because it doesn't work. The char may or may not be followed by a 
nul-byte. 
TT> Most likely it will not.
 Yeah, I didn't think it through.  I did some test's and it worked
 so I assumed it was OK.
TT> Try this instead:
TT> strncat(stringvar, &charvar, 1);
TT> Although I still doubt this is conforming code...
 I think I'll just stick to the method I used in my reply to the
 originator of the thread.
-Roger
... ASCII stupid question and you'll get a stupid ANSI!
--- Msged 4.20 beta 3
(1:273/404@fidonet)
---------------
* Origin: Hodge-Podge Support BBS, Upper Darby, Pennsylvania, USA

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™.