FastLED 3.9.15
Loading...
Searching...
No Matches

◆ readLine()

bool fl::istream_real::readLine ( )
private

Definition at line 136 of file istream.cpp.

136 {
137 // If we have no more data available and no buffered data, we're at EOF
138 if (pos_ >= buffer_len_ && fl::available() == 0) {
139 return false;
140 }
141
142 // Read characters until newline or no more data
143 buffer_len_ = 0;
144 while (fl::available() > 0 && buffer_len_ < BUFFER_SIZE - 1) {
145 int c = fl::read();
146 if (c == -1) break;
147 if (c == '\n') break;
148 if (c == '\r') continue; // Skip carriage return
149 buffer_[buffer_len_++] = static_cast<char>(c);
150 }
151
152 // Null terminate the buffer
153 buffer_[buffer_len_] = '\0';
154 pos_ = 0;
155 return true;
156}
fl::size buffer_len_
Definition istream.h:31
char buffer_[BUFFER_SIZE]
Definition istream.h:30
fl::size pos_
Definition istream.h:32
static const fl::size BUFFER_SIZE
Definition istream.h:29
int available()
Definition io.cpp:117
int read()
Definition io.cpp:148

References fl::available(), buffer_, buffer_len_, BUFFER_SIZE, pos_, and fl::read().

Referenced by get(), operator>>(), peek(), readToken(), and skipWhitespace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: