Browse Source

Update Stream.cpp

teensy4-core
Frank 5 years ago
parent
commit
8d01550ff3
No account linked to committer's email address
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      teensy3/Stream.cpp

+ 5
- 2
teensy3/Stream.cpp View File

@@ -89,6 +89,8 @@ bool Stream::find(const char *target, size_t length)
// as find but search ends if the terminator string is found
bool Stream::findUntil(const char *target, const char *terminator)
{
if(target == NULL) return true;
if(terminator == NULL) return true;
return findUntil(target, strlen(target), terminator, strlen(terminator));
}

@@ -100,9 +102,10 @@ bool Stream::findUntil(const char *target, size_t targetLen, const char *termina
size_t index = 0; // maximum target string length is 64k bytes!
size_t termIndex = 0;
int c;
if( target == NULL) return true;
if( *target == 0) return true; // return true if target is a null string
if(terminator == NULL) return true;

if( *target == 0)
return true; // return true if target is a null string
while( (c = timedRead()) > 0){
if( c == target[index]){
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);

Loading…
Cancel
Save