Using Errno of TFile

Dear community,

i want to check if my file is opened properly for which i use:

by this i get a return value of 2, the file seems to be ok, i can write and save it like i would expect.
After searching for a while i always see, that 2 normaly is the code for “no such file or directory”.
If i provoke an error by open the file i get an error message together with the correct error code, so in principle it seems to work.
Shouldn’t i bother to much because of errno=2? Does someone know a link where these error codes are listed?


I don’t know about the error codes, but when I check for properly opened files, I do this:

  TFile f1("C1.root");
  TFile f2("C2.root");
  TFile f3("C3.root");
  if (f1.IsZombie() || f2.IsZombie() || f3.IsZombie())
      cout << "Error opening the CN.root files." << endl;

IIRC that was the method recommended by experts on this forum.


thanks for your reply.
I will do like you suggested, but still i am interessted into those error codes.
Maybe someone else has an idea.