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.

猜你喜欢

转载自blog.csdn.net/qqyuanhao163/article/details/47867243