Writing Histogram to Ascii File

Hello All,

Reading through the ROOT manual, I see that I can write my histogram data to a .root file like this (pg. 39)

TFile f("histos.root","new"); TH1F h1("hgaus","histo from a gaussian",100,-3,3); h1.FillRandom("gaus",10000); h1->Write();

Is there any way to write the histogram to an ascii file directly? I would like to use Gnuplot on the histogram data later. Right now, I loop through the bin contents and use fprintf. Is there any other way like the one shown above?




h1->SaveAs("h1.C"); or h1->Print("all"); or h1->Print("all"); >h1.C

It is showing error
error: no member named ‘C’ in ‘TH1F’

This moved to a new topic: Read Data from a 2D histogram