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

Hello Mart.
21 Jan 98 19:00, Mart Oruaas wrote to Victor Kemp:
EL>> strcat(stringvar, &charvar);
MO> no, it does not work, because &charvar does not point to null-terminated 
MO> string.
MO> strncat(stringvar, &charvar, 1); is the answer. it copies one character 
MO> from the string pointed by &charvar and then appends \0.
 Are you sure about the '\0' being appended?  I know that
 strncpy does not append a NUL.  I thought that the behavior
 was consistent across all the strnxxx functions.
 -Roger
... E=Mc^5... nahhh...E=Mc^4... nahh...E=Mc^3... I give up.
--- 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™.