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

◆ readLine()

bool fl::istream_real::readLine ( )
private

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

136 {
137 // If we have no more data available and no buffered data, we're at EOF
138 if (mPos >= mBufferLen && fl::available() == 0) {
139 return false;
140 }
141
142 // Read characters until newline or no more data
143 mBufferLen = 0;
144 while (fl::available() > 0 && mBufferLen < 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 mBuffer[mBufferLen++] = static_cast<char>(c);
150 }
151
152 // Null terminate the buffer
153 mBuffer[mBufferLen] = '\0';
154 mPos = 0;
155 return true;
156}
fl::size mBufferLen
Definition istream.h:26
fl::size mPos
Definition istream.h:27
char mBuffer[BUFFER_SIZE]
Definition istream.h:25
static const fl::size BUFFER_SIZE
Definition istream.h:24
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: