scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

strncpy.3 (858B)


      1 .TH strncpy 3
      2 .SH NAME
      3 strncpy - copy bounded-length string
      4 .SH SYNOPSIS
      5 #include <string.h>
      6 
      7 char *strncpy(char *restrict s1, const char *restrict s2, size_t n)
      8 .SH DESCRIPTION
      9 The
     10 .BR strncpy ()
     11 function copies not more than
     12 .I n
     13 characters
     14 (characters that follow a null character are not copied)
     15 from the array pointed to by
     16 .I s2
     17 into the array pointed to by
     18 .IR s1 .
     19 .PP
     20 If copying takes place between objects that overlap,
     21 the behaviour is undefined.
     22 .PP
     23 If the array pointed to by
     24 .I s2
     25 is a string that is shorter than
     26 .I n
     27 characters,
     28 null characters are appended
     29 to the copy in the array pointed to by
     30 .IR s1 ,
     31 until n characters in all have been written.
     32 .PP
     33 The function shall not copy anything if
     34 .I n
     35 is equal to 0.
     36 .SH RETURN VALUE
     37 The
     38 .BR strcpy ()
     39 function shall return the pointer
     40 .IR s1 .
     41 .SH STANDARDS
     42 ISO/IEC 9899:1999 Section 7.21.2.4