1. 程式人生 > >strcpy 會copy '\0'

strcpy 會copy '\0'

SYNOPSIS
       #include <string.h>

       char *strcpy(char *dest, const char *src);

       char *strncpy(char *dest, const char *src, size_t n);



DESCRIPTION
       The   strcpy()  function  copies  the string pointed to by src, including the terminating null byte
       ('\0')
,
 to the buffer pointed to by dest.  The strings may not overlap, and the destination string
       dest must be large enough to receive the copy.


       The  strncpy()  function  is  similar, except that at most n bytes of src are copied.  Warning: If

       there is no null byte among the first n bytes of src, the string placed in dest will not  be  null
       terminated.