MacOS
Arduino IDE2.2.1
Arduino Uno WiFi rev 2
WiFiNINA 1.8.14
Arduino Motor Shield rev 3
for (int i = 0; i < STD_BUFFER_SIZE; ++i) {
if (incomingData1[i].length() > 0) { // Check if the string is not empty
localData1 = atoi(incomingData1[i].c_str());
break; // Stop after converting the first non-empty string
} //if (incomingData1[i].length() > 0)
} //for (int i = 0; i < STD_BUFFER_SIZE; ++i)
I'm using atoi() to change the incoming TCP/IP string to an int. When I run this code as part of a separate sketch, it compiles fine. When I compile the same code as part of a much larger sketch, I get;
error: request for member 'length' in 'incomingData1.arduino::String::operator[](((unsigned int)i))', which is of non-class type 'char'
if (incomingData1[i].length() > 0) { // Check if the string is not empty
Should I be doing the conversion in a different way?
Looks like you've confused String, a class that represents char arrays and the char arrays themselves. Is your buffer a char array or an array of Strings? It looks like you've got bits of code for both things mashed together and it's not going to work.
Try to avoid String when you can on embedded systems. It's there as a crutch for new programmers who haven't learned about arrays yet. But you don't really get to do anything cool until you learn arrays so I say go ahead and learn them.