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

Hi Roger!
24 Jan 98, Roger Scudder kl“bistab klaverit >> Mart Oruaas:
 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.
i don't know, whether all versions of strncpy() add \0 or not, but at least 
it's so under linux with libc 5.3.12.
hmm, i just checked the strncpy man page again, and it says that result is 
not necessarily null-terminated. weird, considering the results of my little 
test program. anyway, it seems to be safer to add \0 "manually" when using 
strncpy().
fazz
--- GEcho 1.11+
---------------
* Origin: l'Ermite (FidoNet 2:490/18)

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