How to add text file into .root file

If I correctly understand, any file could be put into a .root file.
I have text file allin.c. What I’m doing:

[ul]TFile *f = new TFile(“AFile.root”,“RECREATE”);
fie = fopen(“allin.c”, “r” );
then error -
[ul]Error: non class,struct,union object fie used with . or -> (tmpfile):1:
*** Interpreter error recovered [/ul]
if I’m doing like this:
Error: Can’t call TFile::WriteTObject(fie) in current scope (tmpfile):1:
Possible candidates are…
public: virtual Int_t TDirectory::WriteTObject(const TObject
obj,const char
*** Interpreter error recovered ***[/ul]
In advance I apologise if it’s too simple question, but I’m just a beginner.

see class TMacro


TMacro is very nice but would it be possible to overwrite this function:

to have

and also to have some function to obtain content of the macro to TString variable (if it exists then I cannot find it)?

If you have a TString *text, you can call AddLine(text.Data()).

To return all lines in one TString, you can do something like in this example


void mtest() { TMacro m("myscript.C"); TIter next(m.GetListOfLines()); TObjString *objs; TString ms; while((objs=(TObjString*)next())) { ms += objs->GetString(); } }