strdup

Finds and points to a duplicate string.

Format

#include  <string.h>

char *strdup  (const char *s1);
Function Variants This function also has variants named _strdup32 and _strdup64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.8 for more information on using pointer-size-specific functions.

Arguments

s1
The first of two strings to compare.

Description

This function returns a pointer to a string that is an exact duplicate of the string pointed to by s1. The malloc function is used to allocate space for the new string. The strdup function is provided for compatibility with existing systems.

Return Values
A pointer to the resulting string. 
NULL  Indicates an error. 


Previous Page | Next Page | Table of Contents | Index