-
qs regarding fstream
I have two quick questions I was hoping someone could answer.
1) what's the puropse on the ()'s in fin.close() or, as I just saw, cin.fail()? When I tried them without I get "member funciton must be called or address taken from main()".
2) what does ios (as in ios::in) stand for and how do you pronounce it? Is it only used with fstreams?
-
1. Because you're calling member functions. Just like:
Code:
void MyFunc(void) { cout << "Whee\n"; }
int main()
{
MyFunc(); // need () even though no arguments
return (0);
}
/* */
class MyClass {
public:
void MyFunc(void) { cout << "Whee\n"; }
};
int main()
{
MyClass Obj;
Obj.MyFunc();
return(0);
}
and 2. ios is the class that iostream, ostream, and istream are derived from, I believe.
-