T_STRDUP


Name

T_STRDUP — duplicate a string

Synopsis

void T_STRDUP(dest, src) 
T_STR dest; 
T_STR src; 

Arguments

dest — pointer to use for duplicate

src — string to be duplicated

Return Values

None

Diagnostics

None

Description

T_STRDUP is a macro that makes a copy of a string. The duplicated string should be freed with T_FREE when it is no longer needed.

Caution

T_STRDUP evaluates its arguments twice, so do not use ++ or -- in the arguments. For example, the results of T_STRDUP(dest_ptr++, --src_ptr) are undefined.

See Also

T_MALLOC, T_CALLOC, T_REALLOC, T_FREE

Examples

This example duplicates a string:

T_STR dup_1; 
T_STR dup_2; 
 
T_STRDUP(dup_1, "hi there"); 
T_STRDUP(dup_2, dup_1); 

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