Return a newly allocated null-terminated copy of string.
Declared in <bdlb_string.h>
static
char*
copy(
char const* string,
int length,
bslma::Allocator* basicAllocator);
Create a null-terminated copy of the specified string having the specified length (in bytes), using the specified basicAllocator to supply memory, and return the address of the newly-created modifiable string. The string that is returned is owned by the caller. The behavior is undefined unless 0 <= length and basicAllocator is non-null. Note that if string contains any embedded null ('0') characters they will be propagated to the copy.
address of the newly allocated copy
| Name | Description |
|---|---|
| string | string to copy |
| length | length of string in bytes |
| basicAllocator | allocator used to supply memory |