What would be the cleanest way to get std::string from String type?
Thanks,
B.
What would be the cleanest way to get std::string from String type?
Thanks,
B.
You can construct a std::string from a const char *, and String supports operator const char *, so you can just construct the std::string from a String.
#include <string>
void setup()
{
}
void loop()
{
String wiringString("testing");
std::string stdString(wiringString);
Serial.println(stdString.c_str());
delay(2000);
}