Hi, ROOTers
In the documentation of TGFileDialog
I read:
Depending on the dlg_type it can be used for opening or saving a file […]
So I am wondering how to save a file using this widget? And what does it mean to “Save a file”. Now I am using it in the following way:
void CaenGUI::SaveHistos()
{
std::cout << "Saving histograms..." << std::endl;
TGFileInfo fi;
new TGFileDialog( gClient->GetRoot(), fMainFrame, kFDSave, &fi );
TFile* file = new TFile( fi.fFilename, "RECREATE" );
if( file->IsZombie() )
{
new TGMsgBox( gClient->GetRoot(), fMainFrame, "ERROR", "Cannot save data", kMBIconExclamat ion, kMBOk );
delete file;
return;
}
if( fMaxHist != nullptr ) { fMaxHist->Write(); }
if( fIntegralHist != nullptr ) { fIntegralHist->Write(); }
file->Close();
delete file;
}
And I am not sure if I am doing it correctly.
ROOT Version: 6.04/00
Platform: SL7
Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)