#include"Classroom.h"
Classroom::Classroom(){
name = "";
}
void Classroom::initializeClass(string name){
fstream f;
this->name = name;
f.open(name,ios::in);
if (!f)
{
cout<<"File could not be opened"<<endl;
}
//read first line, assign capacity
string firstline;
getline(f,firstline);
string lines;
while (getline(f,lines))
{
//read lines with getline
//parse all lines according to \t or ' ' with stringstream
//When you parse, assign these values to data members of the objct (name, capacity, schedule)
}
}
no idea what this means and, more importantly, how is the text file organized vis-a-vis the layout of the class? What is the relationship b/w lines of the file and data-members of the class?
Not sure about what you meant over there but it looks like your stream escapes from your scope by calling getline() over there. These kind of things affects errors a lot of times and I recommend you to try and no to do it. Those kind of errors are hard to detect most times, unless you use programs like checkmarx or others of course. But in case you don't it's very recommended to try and avoid it. Maybe other design would help.
Good luck with it!
Ben.