#include <fstream> bool fail();
The fail() function returns true if an error has occurred with the current stream, false otherwise.