FastLED 3.10.6
Loading...
Searching...
No Matches

◆ readLine()

bool fl::istream_real::readLine ( )
private

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

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

References fl::available(), BUFFER_SIZE, mBuffer, mBufferLen, mPos, 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: