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

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

STRDUP(3)

Contents


NAME    [Toc]    [Back]

       strdup, strndup - duplicate a string

SYNOPSIS    [Toc]    [Back]

       #include <string.h>

       char *strdup(const char *s);

       char *strndup(const char *s, size_t size);

DESCRIPTION    [Toc]    [Back]

       The  strdup()  function	returns  a  pointer to a new string which is a
       duplicate of the string s.  Memory for the new string is obtained  with
       malloc(3), and can be freed with free(3).

       The  strndup()  works  like  strdup() but it only copies the first size
       bytes. It always add a NUL terminator, unlike strncpy(3).

RETURN VALUE    [Toc]    [Back]

       These functions returns a pointer to the duplicated string, or NULL  if
       insufficient memory was available.

ERRORS    [Toc]    [Back]

       ENOMEM Insufficient memory available to allocate duplicate string.

CONFORMING TO    [Toc]    [Back]

       SVID 3, BSD 4.3

       strndup() is a GNU extension.

SEE ALSO    [Toc]    [Back]

      
      
       calloc(3), malloc(3), realloc(3), free(3)



GNU				  1993-04-12			     STRDUP(3)
[ Back ]
 Similar pages
Name OS Title
wcsdup Linux duplicate a wide-character string
acl_dup FreeBSD duplicate an ACL
SSL_dup_CA_list Tru64 Duplicate the list of CAs
chkdupexe Linux find duplicate executables
dup Linux duplicate a file descriptor
cs_oid_dup Tru64 duplicate an object identifier (OID)
cs_oid_set_dup Tru64 duplicate an object identifier (OID) set
acl_dup Tru64 Creates a duplicate copy of the ACL
t6dup_attr IRIX duplicate security attributes
t6dup_blk IRIX Duplicate security attributes
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service