|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include <iostream>
- #include <string>
- #include <thread>
- #include <chrono>
-
- int
- main(int argc, char *argv[]) {
-
- // std::this_thread::sleep_for(std::chrono::milliseconds(150));
- // Output for read test.
- if (argc == 2) {
-
- // Write a single line and exit.
- if (std::string(argv[1]) == "write") {
- std::cout << "This is a test";
- std::cout.flush();
- return 25;
-
- }
-
- // Exit without writing anything.
- if (std::string(argv[1]) == "quit") {
- return 25;
-
- }
-
- }
-
- char ch;
- while (std::cin >> ch) {
-
- // Exit?
- if ('q' == ch) {
-
- break;
-
- }
-
- std::cout << (char) std::toupper(ch);
- std::cout.flush();
-
- }
-
- return 25;
-
- }
|