and the result in the output file does not show the fileStatus thing( cout<<fileStatus<<endl;) and the textbook says this is used as a control to output files. The fout is obviously a class, how can we assign it to the boolean variable? Would anybody please explain how the boolean expression work(control the output to the file)? Thanks!
im a little confused by your question. Are you trying to see if the file opened successfully with the boolean expression so you can begin writing to it?
Thanks for your clear, neat and thoroughly explanation! I really learn a lot from it. I am sorry I did not make the second question clear. Please see below:
cout<<fileStatus<<endl;
If the fileStatus is 0, will it stop immediately? I mean the
fout<<"information provided by user"<<endl;
fout<<name<<"\n";
fout<<age<<" "<<height<<" "<<weight<<endl;
fout.close();
will not be executed.
In other word, What is the function of the
cout<<fileStatus<<endl;
It seems a little weird to me because it tries to cout a boolean value.