Just a niggling question:

Code:
FILE* f = NULL; 
 
if ((f = fopen("C:\\test.dat", "w")) == NULL)
{
	std::cerr << "Error writing file" << std::endl;
	exit(1);
}
 
// write or whatever
 
fclose (f);
If an error occurs, will the file handle be closed?