Is a root file?

Hi all
Does anyone know how I can check if a file I am trying to open is a root file type?
When I try to open such file using TFile::Open(), TFile prints an error message:

I want to do my own error handling of this situation.

Have a look at TFile doc and the file format description.
You can for example test if the 4 bytes starting at kBegin=100 are equal to “root”