12345678910111213141516171819202122232425 |
- #include <cstring>
- #include <iostream>
- #include "RawReader.h"
- int main() {
- RawReader<10, 5> reader(0, "> ");
- while(reader.canRead()) {
- // simulate work between reads
- std::cout << "Work 1\n";
- reader.updateLine();
- usleep(50000);
- std::cout << "Work 2\n";
- const char* s = reader.readLine();
- if(s != nullptr) {
- std::cout << s << "\n";
- if(strcmp(s, "q") == 0) {
- break;
- }
- }
- }
- return 0;
- }
|