My program is running on ESP32. I'm retrieving some data from Bluetooth, and the Bluetooth string is a C string. I need to save that data in an RTC_DATA_ATTR String, which is a C++ string.
c++string = cstring.c_str(); won't work, since it will just save a pointer to the location in the memory of the C string, and the purpose is to save the data in the RTC memory, so the ESP32 can go to deep sleep without losing the data.
All other data than RTC gets wiped on deep sleep, so there would just be a pointer, pointing to nothing.
How do I get the data copied from the C string to the C++ string?
Any help would be appreciated. A bit of extra info: this is how it is set up at the moment:
RTC_DATA_ATTR String ssid; BLECharacteristic *cSsid = NULL; ssid = cSsid->getValue().c_str();