#include #include // debug #include #include #include int main(int argc, char *argv[]) { // 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; } } std::ofstream log("childProgram.log"); char ch; while (std::cin >> ch) { // Exit? if ('q' == ch) { break; } std::cout << (char) std::toupper(ch); std::cout.flush(); log << (char) std::toupper(ch); log.flush(); } log.close(); return 25; }