Frank 5 years ago
parent
commit
0c2c9e3d75
No account linked to committer's email address
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      teensy4/Stream.cpp

+ 3
- 3
teensy4/Stream.cpp View File

bool Stream::findUntil(const char *target, const char *terminator) bool Stream::findUntil(const char *target, const char *terminator)
{ {
if(target == NULL) return true; if(target == NULL) return true;
if(terminator == NULL) return true;
return findUntil(target, strlen(target), terminator, strlen(terminator));
size_t tlen = (terminator==NULL)?0:strlen(terminator);
return findUntil(target, strlen(target), terminator, tlen);
} }


// reads data from the stream until the target string of the given length is found // reads data from the stream until the target string of the given length is found


if( target == NULL) return true; if( target == NULL) return true;
if( *target == 0) return true; // return true if target is a null string if( *target == 0) return true; // return true if target is a null string
if(terminator == NULL) return true;
if (terminator == NULL) termLen = 0;
while( (c = timedRead()) > 0){ while( (c = timedRead()) > 0){
if( c == target[index]){ if( c == target[index]){

Loading…
Cancel
Save