From f5ba6f19b41bc05d104d3f46ec73a063e0a14abe Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sat, 11 Nov 2023 09:05:57 +0100 Subject: [PATCH] Stop at EOF --- src/input.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index e86fa10..00ace80 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -2,6 +2,7 @@ using namespace std; #include "include/config.h" +#include "include/colors.h" @@ -12,8 +13,11 @@ string get_input() { int line_num = 0; while (1) { line_num++; - printf("%4d ", line_num); - getline(cin, buffer); + printf(BOLD "%4d " RESET , line_num); + if (!getline(cin, buffer)) { + cout << "\rReceived EOF" << endl; + exit(0); + } input += "\n" + buffer; int n = input.length();