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

Roger Scudder wrote in a message to Eric Londaits:
VK>> char stringvar[90];
VK>> char charvar;
VK>> strcat(stringvar, charvar);
EL> strcat takes *char as parameters... so try
EL> strcat(stringvar, &charvar);
 RS>  That's the first time I ever say anybody do that.
 RS>  Very nice solution!  I can't understand why I never see
 RS>  anyone using it.
Because it doesn't work. The char may or may not be followed by a nul-byte. 
Most likely it will not.
Try this instead:
strncat(stringvar, &charvar, 1);
Although I still doubt this is conforming code...
greetings,
Tom
tomtorfs@village.uunet.be
--- timEd/2 1.10+
---------------
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)

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