Hello,
when looking around how Serial is implemented, I stopped at this piece of code in Stream.cpp
If I understand the Arduino reference right then str.length() returns the actual size of the String, which is 0 after initialisation. After that the value of length is not more modified in the loop. So the condition is always while(0 < max).
Do I miss something that is happening in background or is this a bug ?
The same is happening in readStringUntil, too.
when looking around how Serial is implemented, I stopped at this piece of code in Stream.cpp
Code:
String Stream::readString(size_t max)
{
String str;
size_t length = str.length();
while (length < max) {
int c = timedRead();
if (c < 0) {
setReadError();
break; // timeout
}
if (c == 0) break;
str += (char)c;
}
return str;
}
Do I miss something that is happening in background or is this a bug ?
The same is happening in readStringUntil, too.