G
Guest
Hi,
I've been including code like this in my programs for some time:
fstream fin ("c:\\dave.txt", ios::in);
if (!fin)
{
return -1; //or throw an exception, or return false, or
//whatever
}
//do things
fin.close();
However, I've recently started to wonder if I should include
fin.close() in the stuff that executes if(!fin), and also, if I'm not
supposed to, whether anything bad will happen if I do?
I'm also trying to put a few functions together for comp.sys.sinclair,
and would like these to be as compatible as possible, so if anyone
knows the answer to my questions for <fstream.h> as well as <fstream>,
it would be appreciated.
Thanks!
James M.
I've been including code like this in my programs for some time:
fstream fin ("c:\\dave.txt", ios::in);
if (!fin)
{
return -1; //or throw an exception, or return false, or
//whatever
}
//do things
fin.close();
However, I've recently started to wonder if I should include
fin.close() in the stuff that executes if(!fin), and also, if I'm not
supposed to, whether anything bad will happen if I do?
I'm also trying to put a few functions together for comp.sys.sinclair,
and would like these to be as compatible as possible, so if anyone
knows the answer to my questions for <fstream.h> as well as <fstream>,
it would be appreciated.
Thanks!
James M.