Update FromFile()

This commit is contained in:
Loic Guegan 2022-01-25 17:46:29 +01:00
parent e063e1453c
commit 8a770f9133

View file

@ -26,11 +26,12 @@ PGN::~PGN() {
std::string PGN::GetResult() { return (result); }
void PGN::FromFile(std::string filepath) {
std::ifstream file(filepath);
std::ifstream inFile;
inFile.open(filepath);
std::stringstream strStream;
strStream << inFile.rdbuf();
std::string pgn_content((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
this->pgn_content = pgn_content;
this->pgn_content = strStream.str();
}
void PGN::FromString(std::string pgn_content) {
@ -46,7 +47,6 @@ void PGN::ParseNextGame(){
tagkeys.clear();
tags.clear();
moves = new HalfMove();
int loc = NextNonBlank(LastGameEndLoc);
if (IS_EOF(loc)) {