STRDUP(3) Library Functions Manual STRDUP(3)
NAME
strdup — duplicate
a string
SYNOPSIS
char *strdup(const char *s1);
DESCRIPTION
The strdup () function shall return a
pointer to a new string, which is a duplicate of the string pointed to by
s1. The
returned pointer can be passed to free(3). A null pointer
is returned if the new string cannot be created.
RETURN VALUE
The strdup () function shall return a
pointer to a new string on success. Otherwise, it shall return a null
pointer and set
errno to
indicate the error.
ERRORS
The strdup () function may fail if:
- [ENOMEM]
- Storage space available is insufficient.
EXAMPLES
None.
APPLICATION USAGE
None.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
free(3), malloc(3), the Base Definitions volume of IEEE Std 1003.1-2001 (“POSIX.1”), <string.h>
CHANGE HISTORY
First released in Issue 4, Version 2.
Issue 5
Moved from X/OPEN UNIX extension to BASE.
End of informative text. footer end
December 6, 2001 posix.fail