JsonBuffer::strdup()
Obsolete
JsonBuffer::strdup()
is deprecated since ArduinoJson 5.13.When the rules for string duplication changed, this function became useless.
Description
Makes a copy of the specified string in the JsonBuffer
.
The memory is released when the JsonBuffer
is destructed.
Signatures
const char* strdup(const char* str);
const char* strdup(const String& str);
const char* strdup(const std::string& str);
const char* strdup(const __FlashStringHelper* str);
Arguments
str
, the string to duplicate.
Return value
A newly allocate string, filled with a copy of str
.
Example
StaticJsonBuffer<200> jsonBuffer;
char orig[16] = "hello";
const char* dupl = jsonBuffer.strdup(orig);
strcpy(orig, "world");
Serial.println(dupl); // world
Serial.println(orig); // hello