Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions io/io/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ TFile::TFile() : TDirectoryFile(), fCompress(ROOT::RCompressionSetting::EAlgorit
/// ~~~{.cpp}
/// TFile *f = TFile::Open("tmpname.root?reproducible=fixedname","RECREATE","File title");
/// ~~~
///
/// To check for the health status of a TFile and detect corruption, you can perform the following checks after opening it:
/// ~~~{.cpp}
/// std::unique_ptr<TFile> f{TFile::Open("name.root", "READ")};
/// auto bad_input = (f == nullptr); // File could not be open, e.g. if input url was incorrect or incorrect permissions.
/// auto bad_initalization = (f && f->IsZombie()); // something went wrong in the constructor, for example when TFile is corrupt
/// auto bad_storage = (f && f->TestBit(TFile::kRecovered)); // The TFile had to run the recovery mechanism when opening the file; often due to the file being incorrectly closed.
/// ~~~

Comment thread
ferdymercury marked this conversation as resolved.
TFile::TFile(const char *fname1, Option_t *option, const char *ftitle, Int_t compress)
: TDirectoryFile(), fCompress(compress), fUrl(fname1,kTRUE)
Expand Down