I am new to the group, so be kind. I am also just above noob level in C programing so bear with me. I am using the Arduino SDK to code in and push the code to my ESP8266 and ESP32. The following code works great on my ESP32, but causes a CPU panic on my ESP8266. The area I am having problems with is where I am trying to get the fourth node of my IP address. I want to use this variable as part of the MQTT name and topic. As I mentioned, this works on my ESP32 just fine.
froM = WiFi.localIP().toString().lastIndexOf(".")+1;
tO = WiFi.localIP().toString().length()+1;
nodeFour = WiFi.localIP().toString().substring(froM, tO).c_str();
I have also attached the complete code.
Any help would be greatly appreciated.