diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index bb723d0e82..f134892501 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -92,6 +92,13 @@ void PotentialFileReader::ignore_comments(bool value) reader->ignore_comments = value; } +/** Reset file to the beginning */ + +void PotentialFileReader::rewind() +{ + reader->rewind(); +} + /** Read a line but ignore its content */ void PotentialFileReader::skip_line() diff --git a/src/potential_file_reader.h b/src/potential_file_reader.h index e7484a96ac..466419b676 100644 --- a/src/potential_file_reader.h +++ b/src/potential_file_reader.h @@ -43,6 +43,7 @@ class PotentialFileReader : protected Pointers { void ignore_comments(bool value); + void rewind(); void skip_line(); char *next_line(int nparams = 0); void next_dvector(double *list, int n); diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index ab1c81efb1..317b44e36e 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -82,6 +82,13 @@ TextFileReader::~TextFileReader() if (closefp) fclose(fp); } +/** Reset file to the beginning */ + +void TextFileReader::rewind() +{ + ::rewind(fp); +} + /** Read the next line and ignore it */ void TextFileReader::skip_line() diff --git a/src/text_file_reader.h b/src/text_file_reader.h index e5a743580f..30ec9351be 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -38,6 +38,7 @@ class TextFileReader { ~TextFileReader(); + void rewind(); void skip_line(); char *next_line(int nparams = 0);