Despite recent developments (<format> and <print>), iostreams will be with us for the foreseeable future.
One of the quirks of iostreams is their approach to error handling, with errors represented using flags and error states.
Compiler Explorer link: https://compiler-explorer.com/z/eh5noa66f