I am using an esp32 to publish to a mqtt broker. Users are able to enter a mqtt prefix to a mqtt topic using wifimanager. All boards using the mqtt prefix are hanging within a couple of days. All boards where no prefix is entered are working fine. I use the following code to put the prefix before the topic:
The use of Strings has a bad reputation in the forum mainly for potentially causing memory fragmentation when the contents of a String is changed, which you are doing very frequently
Why not use C strings throughout rather than Strings. This is especially the case since the Strings are eventually converted to a C string anyway
I try to understand C strings but I can't manage to convert the code to it. Is the only thing I have to do is point the string to a place in memory using straight brackets like this?