Skip to main content

stpncpy

Function stpncpy 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn stpncpy( s1: *mut c_char, s2: *const c_char, n: size_t, ) -> *mut c_char
Expand description

See https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncpy.html.

Copies not more than n bytes (bytes that follow a NUL character are not copied) from the array pointed to by s2 to the array pointed to by s1.

If the array pointed to by s2 is a string that is shorter than n bytes, NUL characters shall be appended to the copy in the array pointed to by s1, until n bytes in all are written.

If any NUL characters are written to the destination, returns the address of the first such NUL character. If no NUL characters are written to the destination, returns &s1[n].

ยงSafety

If copying takes place between objects that overlap, the behaviour is undefined.