Can I output a fitted function to a file?

Dear everyone,

When in PAW, I could use SMOOTH command to fit a curve, and the fitted function can output to a file HQUADF.DAT.
So in ROOT, Can I do the same thing?
Thanks.

You can draw the function and generate the code for the primitives in the canvas by selecting the “Save as Canvas.C” item in the canvas “File” menu or simply save the code for the function to a file as shown below

#include “Riostream.h"
void fsave() {
TCanvas c1;
TH1F h(“h”,“h”,1000,-3,3);
h.FillRandom(“gaus”,50000);
TF1 *f1 = new TF1(“f1”,“gaus”,-3,3);
h.Fit(f1,“n”);
//f1->Draw();
ofstream s(“fsave.dat”);
f1->SavePrimitive(s,”");
}

Rene

Many thanks!
But, how can I use the saved function file independently. I mean I need not to use any ROOT lib or class and this function can be used in any standard
c or c++ program.
Thanks again!