Hi,
you should #include the C++ version of the fstream header:
#include "ana.h" #include <TH2.h> #include <TStyle.h> #include <fstream> //the line I added in ana.C
using namespace std;
ofstream output("out.txt"); //the line I added in ana.C
output<<"the output text"; //the line I added in ana.C
Does that help?
Cheers, Axel.
Zhijun Liang wrote:
> dear all:
> I meet some problem in using fstream object in files generated by makeselector or makeclass .
> could you help me?
> for example :in tutorial directory
> ""
> TFile f("tree1.root");
> t1->MakeSelector("ana");
> ""
> and then I add 4 lines in ana.C to do file output .
>
> """
> #include "ana.h"
> #include <TH2.h>
> #include <TStyle.h>
> #include <fstream.h> //the line I added in ana.C
> #include <iostream.h> //the line I added in ana.C
> ofstream output("out.txt",ios::out); //the line I added in ana.C
> output<<"the output text"; //the line I added in ana.C
> """
> and then I use
> "'
> TFile f("tree1.root");
> t1->process("ana.C+");
> ""
> error message is :
> Error: Symbol output is not defined in current scope ana.C:32:
> Error: << Illegal operator for pointer 3 ana.C:32:
>
> it seems the fstream can not be used in makeselector files ,could you help me?
> thank you
>
> best regards
> Liang
>
Received on Thu Oct 12 2006 - 15:56:59 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET