vector<Log_Entry> parse(string);
This function does the following:
Open a log file specified by the parameter name (File I/O).
Read lines from the opened file.
Create a Log_Entry object passing the line just input.
Push each Log_Entry object onto a vector.
Return the vector of Log_Entrys.
I'm unsure on how I'm going to create a Log_Entry object and pass the line just input...
Here is what I have so far:
Expand|Select|Wrap|Line Numbers
- std::vector<Log_Entry> parse(const string& filename)
- {
- vector<Log_Entry> log_entries;
- std::string line;
- ifstream in_file(filename.c_str());
- if(!in_file)
- {
- // couldn't open input file, exit
- cerr << "Error: couldn't open "
- << filename
- << " exiting\n";
- exit(1);
- }
- while(!in_file.eof())
- {
- getline(in_file, line);
- }
- in_file.close();
- return log_entries;
- }