0

My code

    #include "stdafx.h"
    #include "library_list.h"

    using namespace std;
    library_list::library_list(string filePath){

        ifstream library_read_file_pointer(filePath);
        string line_data_read_from_library_data_file;
        while (!library_read_file_pointer.eof()){
            getline(library_read_file_pointer, line_data_read_from_library_data_file);
            library_read l(line_data_read_from_library_data_file);//l is a library_read object that will parse
            lirary_data.push_back(l);//l content will save in vector(library data)

        }
        library_read_file_pointer.close();
    }

The problem is that getline is reading the new line as a data and my main program is showing last data two times how I can make eof or getline to ignore/don't read the new line.

Paul Roub
  • 35,100
  • 27
  • 72
  • 83

0 Answers0