Trying to save a simple boolean into a data file, and load it

This is a discussion on Trying to save a simple boolean into a data file, and load it within the C++ Programming forums, part of the General Programming Boards category; Code:
bool savevars(int vars[28][14])
{
using std::ofstream;
int loop;
int loop1;
char *temp = new char;
ofstream filestr;
filestr.open ("data.dat");
...

The fstream's destructor will close the file on its own without you needing to explicitly call the close member function. In any case, if you do want to include an explicit call, it must go before the return statement and not after.

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens