strncpy

Michael T. Sullivan sullivan at aqdata.uucp
Fri Dec 22 05:32:42 AEST 1989


>From article <11509 at csli.Stanford.EDU>, by poser at csli.Stanford.EDU (Bill Poser):
> 
> 	Why is it that strncpy(3) does not null terminate
> the string if the length of the source string is greater than
> or equal to the length of the target buffer? I cannot think of

It's so you can do things like:

	strncpy(s1, s2, len)[len] = '\0';

and really freak people out! :-)
-- 
Michael Sullivan          uunet!jarthur.uucp!aqdata!sullivan
aQdata, Inc.
San Dimas, CA



More information about the Comp.lang.c mailing list