strncpy
Chris Straut
cns at stiatl.UUCP
Fri Dec 22 00:29:46 AEST 1989
In article <11509 at csli.Stanford.EDU> poser at csli.Stanford.EDU (Bill Poser) writes:
> 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?
[ other stuff deleted ]
I agree that strncpy should null terminate the resulting string. The
definition of a string in the C language is a null terminated char array.
And the function called (str)ncpy indicates a string operation, which by
default should create a null terminated string. To overcome this 'feature'
we wrote our own strncpy function, which is benefical to the unsuspecting
programmer (or novice), and the result is a null terminated string.
--
Christopher Straut | Go Jackets!!!!! gatech!stiatl!cns
Sales Technologies, Inc |
3399 Peachtree Rd, NE |
Atlanta, GA (404) 841-4000 |
More information about the Comp.lang.c
mailing list