1.\" Copyright (c) 1990, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)strdup.3 5.3 (Berkeley) 04/19/91 7.\" 8.Dd 9.Dt STRDUP 3 10.Os 11.Sh NAME 12.Nm strdup 13.Nd save a copy of a string 14.Sh SYNOPSIS 15.Fd #include <string.h> 16.Ft char * 17.Fn strdup "const char *str" 18.Sh DESCRIPTION 19The 20.Fn strdup 21function 22allocates sufficient memory for a copy 23of the string 24.Fa str , 25does the copy, and returns a pointer to it. 26The pointer may subsequently be used as an 27argument to the function 28.Xr free 3 . 29.Sh SEE ALSO 30.Xr calloc 3 31.Xr malloc 3 32.Xr realloc 3 33.Xr free 3 34.Sh HISTORY 35The 36.Fn strdup 37function 38.Ud . 39