FastLED 3.10.8
Loading...
Searching...
No Matches

◆ readLine()

bool fl::istream_real::readLine ( )
private

Definition at line 138 of file istream.cpp.hpp.

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

References fl::available(), BUFFER_SIZE, fl::FL_NO_EXCEPT, mBuffer, mBufferLen, mPos, and fl::read().

Referenced by get(), peek(), and skipWhitespace().

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