Stop at EOF
This commit is contained in:
parent
b07c06ec9f
commit
f5ba6f19b4
@ -2,6 +2,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "include/config.h"
|
#include "include/config.h"
|
||||||
|
#include "include/colors.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -12,8 +13,11 @@ string get_input() {
|
|||||||
int line_num = 0;
|
int line_num = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
line_num++;
|
line_num++;
|
||||||
printf("%4d ", line_num);
|
printf(BOLD "%4d " RESET , line_num);
|
||||||
getline(cin, buffer);
|
if (!getline(cin, buffer)) {
|
||||||
|
cout << "\rReceived EOF" << endl;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
input += "\n" + buffer;
|
input += "\n" + buffer;
|
||||||
|
|
||||||
int n = input.length();
|
int n = input.length();
|
||||||
|
Loading…
Reference in New Issue
Block a user