| 134 | } |
| 135 | |
| 136 | bool istream_real::readLine() { |
| 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 | } |
| 157 | |
| 158 | void istream_real::skipWhitespace() { |
| 159 | while (mPos < mBufferLen && |