*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Linux man pages -> strcpy (3)              
Title
Content
Arch
Section
 

STRCPY(3)

Contents


NAME    [Toc]    [Back]

       strcpy, strncpy - copy a string

SYNOPSIS    [Toc]    [Back]

       #include <string.h>

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

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

DESCRIPTION    [Toc]    [Back]

       The  strcpy()  function	copies the string pointed to by src (including
       the terminating `\0' character) to the array 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 not more than n bytes of
       src  are copied. Thus, if there is no null byte among the first n bytes
       of src, the result wil not be null-terminated.

       In the case where the length of src is less than that of n, the remainder
 of dest will be padded with nulls.

RETURN VALUE    [Toc]    [Back]

       The  strcpy()  and strncpy() functions return a pointer to the destination
 string dest.

BUGS    [Toc]    [Back]

       If the destination string of a strcpy() is not large enough  (that  is,
       if  the programmer was stupid/lazy, and failed to check the size before
       copying) then anything might happen.  Overflowing fixed length  strings
       is a favourite cracker technique.

CONFORMING TO    [Toc]    [Back]

       SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO    [Toc]    [Back]

      
      
       bcopy(3), memccpy(3), memcpy(3), memmove(3)



GNU				  1993-04-11			     STRCPY(3)
[ Back ]
 Similar pages
Name OS Title
XmStringCopy Tru64 A compound string function that makes a copy of a string
XmStringCopy HP-UX A compound string function that makes a copy of a string
XmStringCopy IRIX A compound string function that makes a copy of a string
strdup NetBSD save a copy of a string
bcopy FreeBSD copy byte string
bcopy NetBSD copy byte string
strdup OpenBSD save a copy of a string
memcpy FreeBSD copy byte string
memmove FreeBSD copy byte string
memcpy NetBSD copy byte string
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service