From bc2d662c1dbfc8bdecc02ca8ff084e672f498305 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Thu, 18 Nov 2021 22:25:07 +0800 Subject: [PATCH] - fix: console program that needs input may crash --- NEWS.md | 3 +++ tools/ConsolePauser/main.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1b7010cc..8628c40b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +Version 0.9.2 For Dev-C++ 7 Beta + - fix: console program that needs input may crash + Version 0.9.1 For Dev-C++ 7 Beta - enhancement: code completion suggestion for "__func__" variable - fix: ide failed to start, if there are errors in the compiler set settings diff --git a/tools/ConsolePauser/main.cpp b/tools/ConsolePauser/main.cpp index 96b7deac..a09d01bb 100644 --- a/tools/ConsolePauser/main.cpp +++ b/tools/ConsolePauser/main.cpp @@ -184,6 +184,8 @@ int main(int argc, char** argv) { SetStdHandle(STD_ERROR_HANDLE, hOutput); freopen("CONOUT$","w+",stdout); freopen("CONOUT$","w+",stderr); + } else { + FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); } // Save starting timestamp