strncpy
John S. Price
john at stat.tamu.edu
Wed Jan 24 12:35:55 AEST 1990
In article <11882 at csli.Stanford.EDU> poser at csli.stanford.edu (Bill Poser) writes:
>...[stuff deleted]...
>So, what strncpy does is to COPY up to the null byte or N characters,
>whichever comes first, and then null-pad out to the N character limit.
This is exactly right. Strncpy copys exactly N characters from
source to destination. If N > strlen(source) then strncpy
cannot assume that the bytes after the NULL in source are
part of the string. The manuals aren't ambiguous if you
take into consideration the definition of a string.
--------------------------------------------------------------------------
John Price | It infuriates me to be wrong
john at stat.tamu.edu | when I know I'm right....
--------------------------------------------------------------------------
More information about the Comp.lang.c
mailing list