Make a heap copy of a string.
This function allocates memory on the host's heap, copies no more than n bytes from the str parameter to that memory, and returns a pointer to the newly allocated memory.
- Parameters
-
str | The string to be copied. |
n | The number of characters to be copied. |
- Returns
- A pointer to the newly allocated string or NULL if unable to allocate the storage.