use getline in script parser

This commit is contained in:
wangjiacai 2022-01-14 14:40:45 +08:00
parent 8211247e87
commit 5acc341171

View File

@ -1,8 +1,7 @@
#include <script_parser.h>
#include <boost/test/unit_test.hpp>
#include <fstream>
#include <iostream>
#include <script_parser.h>
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 <<endl;
}
script.close();
}
return 0;