![]() |
Overview Copies a string. Original class CORBA
Intended Usage
This method is intended to be used by client and server applications to duplicate (copy) data of type CORBA::String. The resulting string should be subsequently freed using CORBA::string_free(). If the input value is NULL, the return value will be NULL.
Strings to be passed on remote method invocations or whose ownership is to be transferred from one library to another should be allocated using CORBA::string_alloc() or CORBA::string_dup() rather than the C++ new[] operator. This insures that string memory is deleted using the same C++ run time that originally allocated it.
IDL Syntax
static char* string_dup(const char* str);
Input parameters
- str
- The NULL-terminated string to be copied.
Return values
- char*
- A copy of the input string. This storage should be subsequently freed using CORBA::string_free() rather than the C++ delete[] operator. NULL is returned if the storage cannot be allocated.
Example
See the example for the CORBA::string_alloc method.