Main.cpp 516 B

12345678910111213141516171819202122232425
  1. #include <iostream>
  2. #include <cstring>
  3. #include "RawReader.h"
  4. int main() {
  5. RawReader<10, 5> reader(0, "> ");
  6. while(reader.canRead()) {
  7. // simulate work between reads
  8. std::cout << "Work 1\n";
  9. reader.updateLine();
  10. usleep(50000);
  11. std::cout << "Work 2\n";
  12. const char* s = reader.readLine();
  13. if(s != nullptr) {
  14. std::cout << s << "\n";
  15. if(strcmp(s, "q") == 0) {
  16. break;
  17. }
  18. }
  19. }
  20. return 0;
  21. }