如何将 Arduino String 转换为 std::string
如果你有一个 Arduino String:
arduino_string_example.cpp
String arduinoStr = "test123";你可以使用以下命令轻松将其转换为 std::string:
arduino_to_stdstring.cpp
std::string stdStr(arduinoStr.c_str(), arduinoStr.length());std::string 构造函数将**复制数据,**因此你可以安全地释放 Arduino String 实例。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow