
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <string.h>
char *strdup( const char *src );
char *_strdup( const char *src );
char __far *_fstrdup( const char __far *src );
#include <wchar.h>
wchar_t *_wcsdup( const wchar_t *src );
#include <mbstring.h>
unsigned char *_mbsdup( unsigned char *src );
unsigned char __far *_fmbsdup( unsigned char __far *src );
Description:
The strdup function creates a duplicate copy of the string pointed to by
src and returns a pointer to the new copy. For strdup, the memory for
the new string is obtained by using the malloc function and can be
freed using the free function. For _fstrdup, the memory for the new
string is obtained by using the _fmalloc function and can be freed
using the _ffree function.
The _strdup function is identical to strdup. Use _strdup for ANSI/ISO
naming conventions.
The _fstrdup function is a data model independent form of the strdup
function that accepts far pointer arguments. It is most useful in mixed
memory model applications.
The _wcsdup function is a wide-character version of strdup that operates
with wide-character strings.
The _mbsdup function is a multibyte character version of strdup that
operates with multibyte character strings.
The _fmbsdup function is a data model independent form of the _mbsdup
function that accepts far pointer arguments. It is most useful in mixed
memory model applications.
Returns:
The strdup function returns the pointer to the new copy of the string if
successful, otherwise it returns NULL.
Example:
#include <stdio.h>
#include <string.h>
void main()
{
char *dup;
dup = strdup( "Make a copy" );
printf( "%s\n", dup );
}
Classification:
WATCOM
_strdup conforms to ANSI/ISO naming conventions
Systems:
strdup - All, Netware
_strdup - All, Netware
_fstrdup - All
_wcsdup - All
_mbsdup - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
_fmbsdup - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
See Also:
free, malloc, strcpy, strncpy
See Also:
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson