TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ROGER SCUDDER
from: GEORGE WHITE
date: 1998-01-28 21:41:00
subject: char to string

Hi Roger,
RS>MO> strncat(stringvar, &charvar, 1); is the answer. it copies one 
haracter
RS>MO> from the string pointed by &charvar and then appends \0.
RS> Are you sure about the '\0' being appended?  I know that
RS> strncpy does not append a NUL.  I thought that the behavior
RS> was consistent across all the strnxxx functions.
According to my documentation (MS, Borland, IBM & Watcom), yes it is.
Unfortunately the behaviour is not consistant and there are subtle
differences between the behavior of strncat() and strncpy() which can
trap the unwary.
George
 * SLMR 2.1a * All Trademarks acknowledged (just in case ).
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)

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