TutStrDup


Name

TutStrDup — copies a string

Synopsis

T_STR TutStrDup(str) 
T_STR str;  

Arguments

str — string to be duplicated

Return Values

Pointer to the duplicate string.

Diagnostics

None

Description

TutStrDup makes a copy of the character string. It takes a pointer to a string as an argument and returns a pointer to the copy of that string. When the duplicate string is no longer needed, it should be disposed of with the T_FREE macro.

Caution

Failure to properly dispose of the duplicate string creates a memory leak.

See Also

TutStrUpr, TutStrLwr

Examples

This example duplicates a string:

T_CHAR strptr[80], 
T_STR dup_string; 
 
strcpy(strptr, "This is a duped string"); 
dup_string = TutStrDup(strptr); 
TutOut("%s\n", dup_string); 
. 
. 
. 

The TutOut statement produces this output:

This is a duped string 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com