From 52498b2d53eddfa17300805895bbfd65656f2db9 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 11 Jul 2023 10:08:59 +0800 Subject: [PATCH] Replace the ignore function in READ_VALUE with getline. --- source/module_base/global_function.h | 3 ++- source/module_io/input.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/module_base/global_function.h b/source/module_base/global_function.h index 358454cc1d8..d52193d9123 100644 --- a/source/module_base/global_function.h +++ b/source/module_base/global_function.h @@ -147,7 +147,8 @@ template static void READ_VALUE(std::ifstream &ifs, T &v) { ifs >> v; - ifs.ignore(150, '\n'); + std::string line; + getline(ifs, line); return; } diff --git a/source/module_io/input.h b/source/module_io/input.h index 52648eebc27..033f539f221 100644 --- a/source/module_io/input.h +++ b/source/module_io/input.h @@ -577,7 +577,8 @@ class Input template static void read_value(std::ifstream &ifs, T &var) { ifs >> var; - ifs.ignore(150, '\n'); + std::string line; + getline(ifs, line); return; } void read_kspacing(std::ifstream &ifs)