G
Guest
I have "unhandled exception" in line 12. Why?
The other code works fine (if I use line 11 instead of 12).
file allacated by new (not in stack)
----------------------------------------------------
01 vector<string> Machine::getINIlines(ifstream &file)
02 {
03 vector<string> lines;
04 string s;
05 while(!file.eof())
06 {
07 getline(file, s);
08 s = trim(s);
09 if (s[0] != '#') lines.push_back(s);
10 }
11 // file.close();
12 delete file;
13 return lines;
14 }
The other code works fine (if I use line 11 instead of 12).
file allacated by new (not in stack)
----------------------------------------------------
01 vector<string> Machine::getINIlines(ifstream &file)
02 {
03 vector<string> lines;
04 string s;
05 while(!file.eof())
06 {
07 getline(file, s);
08 s = trim(s);
09 if (s[0] != '#') lines.push_back(s);
10 }
11 // file.close();
12 delete file;
13 return lines;
14 }