From 5acc341171bb4685169323e14237276c43d6e040 Mon Sep 17 00:00:00 2001 From: wangjiacai Date: Fri, 14 Jan 2022 14:40:45 +0800 Subject: [PATCH] use getline in script parser --- src/script_parser.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/script_parser.cpp b/src/script_parser.cpp index af06282..844f678 100644 --- a/src/script_parser.cpp +++ b/src/script_parser.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include using namespace boost::unit_test; using namespace std; @@ -13,10 +12,11 @@ int parseScript(const char* path) { perror(path); return ENOENT; } else { - std::stringstream strbuf; - strbuf << script.rdbuf(); - std::string contents(strbuf.str()); - cout << contents << endl; + string line; + while(getline(script, line, '\n')) { + cout << line <