diff --git a/compiled_starters/cpp/src/Server.cpp b/compiled_starters/cpp/src/Server.cpp index 625f12a..8510ded 100644 --- a/compiled_starters/cpp/src/Server.cpp +++ b/compiled_starters/cpp/src/Server.cpp @@ -11,6 +11,10 @@ bool match_pattern(const std::string& input_line, const std::string& pattern) { } int main(int argc, char* argv[]) { + // Flush after every std::cout / std::cerr + std::cout << std::unitbuf; + std::cerr << std::unitbuf; + // You can use print statements as follows for debugging, they'll be visible when running tests. std::cout << "Logs from your program will appear here" << std::endl; diff --git a/solutions/cpp/01-cq2/code/src/Server.cpp b/solutions/cpp/01-cq2/code/src/Server.cpp index 25a364b..39d39f2 100644 --- a/solutions/cpp/01-cq2/code/src/Server.cpp +++ b/solutions/cpp/01-cq2/code/src/Server.cpp @@ -11,6 +11,10 @@ bool match_pattern(const std::string& input_line, const std::string& pattern) { } int main(int argc, char* argv[]) { + // Flush after every std::cout / std::cerr + std::cout << std::unitbuf; + std::cerr << std::unitbuf; + if (argc != 3) { std::cerr << "Expected two arguments" << std::endl; return 1; diff --git a/solutions/cpp/01-cq2/diff/src/Server.cpp.diff b/solutions/cpp/01-cq2/diff/src/Server.cpp.diff index e54accc..17dc2de 100644 --- a/solutions/cpp/01-cq2/diff/src/Server.cpp.diff +++ b/solutions/cpp/01-cq2/diff/src/Server.cpp.diff @@ -1,4 +1,4 @@ -@@ -1,45 +1,40 @@ +@@ -1,49 +1,44 @@ #include #include @@ -12,6 +12,10 @@ } int main(int argc, char* argv[]) { + // Flush after every std::cout / std::cerr + std::cout << std::unitbuf; + std::cerr << std::unitbuf; + - // You can use print statements as follows for debugging, they'll be visible when running tests. - std::cout << "Logs from your program will appear here" << std::endl; - diff --git a/starter_templates/cpp/src/Server.cpp b/starter_templates/cpp/src/Server.cpp index 625f12a..8510ded 100644 --- a/starter_templates/cpp/src/Server.cpp +++ b/starter_templates/cpp/src/Server.cpp @@ -11,6 +11,10 @@ bool match_pattern(const std::string& input_line, const std::string& pattern) { } int main(int argc, char* argv[]) { + // Flush after every std::cout / std::cerr + std::cout << std::unitbuf; + std::cerr << std::unitbuf; + // You can use print statements as follows for debugging, they'll be visible when running tests. std::cout << "Logs from your program will appear here" << std::endl;