Thanks very much!
I had ifile declared as a private (ifstream) member of the class anyway but I guess because I used the line
ifstream ifile(input, ios::in);
It overloaded the variable (so it was referring to a local ifile) or something and like you said invoked the destructor when it went...
I have the following constructor for a class:
Cdata::Cdata(char *input)
{
//Try and open the input file
ifstream ifile(input, ios::in);
if(!ifile.is_open())
{
cout << "The input file didn't open!" << endl;
exit(1);
}
}
When I call the constructor...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.