cppreference.com > C++ I/O > fail
fail
Syntax:
  #include <fstream>
  bool fail();

The fail() function returns true if an error has occurred with the current stream, false otherwise.