STRDUP(3) Library Functions Manual STRDUP(3)

strdupduplicate a string


#include <string.h>

char *strdup(const char *s1);

The strdup () function shall return a pointer to a new string, which is a duplicate of the string pointed to by . The returned pointer can be passed to free(3). A null pointer is returned if the new string cannot be created.

The strdup () function shall return a pointer to a new string on success. Otherwise, it shall return a null pointer and set to indicate the error.

The strdup () function may fail if:

Storage space available is insufficient.

None.

None.

None.

None.

free(3), malloc(3), the Base Definitions volume of IEEE Std 1003.1-2001 (“POSIX.1”), <string.h>

First released in Issue 4, Version 2.

Moved from X/OPEN UNIX extension to BASE.

footer end

December 6, 2001 posix.fail