diff --git a/src/command_line.cc b/src/command_line.cc index 3c8b023f..e1674dee 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -478,7 +478,7 @@ int main(int argc, char** argv) { if (HasOption(options, "--wait-for-input")) { std::cerr << std::endl << "[Enter] to exit" << std::endl; - std::cin.get(); + getchar(); } if (print_help) { diff --git a/src/language_server_api.cc b/src/language_server_api.cc index 08f3f6b5..440e0fee 100644 --- a/src/language_server_api.cc +++ b/src/language_server_api.cc @@ -5,6 +5,7 @@ #include #include +#include #include MessageRegistry* MessageRegistry::instance_ = nullptr; @@ -107,8 +108,8 @@ TEST_SUITE("FindIncludeLine") { } optional ReadCharFromStdinBlocking() { - char c; - if (std::cin.read(&c, 1)) + int c = getchar(); + if (c >= 0) return c; return nullopt; } diff --git a/src/test.cc b/src/test.cc index e83004f7..264be2e3 100644 --- a/src/test.cc +++ b/src/test.cc @@ -5,6 +5,7 @@ #include "serializer.h" #include "utils.h" +#include #include void Write(const std::vector& strs) { @@ -96,8 +97,8 @@ std::string FindExpectedOutputForFilename( } std::cerr << "Couldn't find expected output for " << filename << std::endl; - std::cin.get(); - std::cin.get(); + getchar(); + getchar(); return "{}"; } @@ -243,8 +244,8 @@ bool RunIndexTests(const std::string& filter_path, bool enable_update) { << "[Enter to continue - type u to update test, a to update all]"; char c = 'u'; if (!update_all) { - c = (char)std::cin.get(); - std::cin.get(); + c = getchar(); + getchar(); } if (c == 'a')