3 ms·
strncpy have the danger of not putting a null character at the end of the destination , if source is longer than num. > Copies the first num characters of sour
by Zardoz84 7y ago
strncpy have the danger of not putting a null character at the end of the destination , if source is longer than num.
> Copies the first num characters of source to destination. If the end of the source C string (which is signaled by a null-character) is found before num characters have been copied, destination is padded with zeros until a total of num characters have been written to it.
No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).