From 5120df42f6eb0dea32aef4659daaaa7abb1e53d8 Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Thu, 12 Sep 2024 10:01:15 -0400 Subject: [PATCH] fix: seek to beginning of config file after looking for verbose key (#33) * fix: seek to beginning of config file after looking for verbose key; fixes #32 * fix: clear ifstream flags before seeking Co-authored-by: Nels --------- Co-authored-by: Nels --- src/lgar.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lgar.cxx b/src/lgar.cxx index f5a497d..5c02def 100755 --- a/src/lgar.cxx +++ b/src/lgar.cxx @@ -205,6 +205,9 @@ extern void InitFromConfigFile(string config_file, struct model_state *state) } } + // seek to beginning of input after searching for 'verbosity' + fp.clear(); + fp.seekg(0, fp.beg); if (verbosity.compare("none") != 0) { std::cerr<<"------------- Initialization from config file ---------------------- \n"; @@ -2646,4 +2649,4 @@ extern double lgar_theta_mass_balance(int layer_num, int soil_num, double psi_cm } -#endif \ No newline at end of file +#endif