GEN
1
I want to output a list of contents of a root file into txt. file.
I tried
TFile* f_in = new TFile(sample.root);
TFile fout("datanames.txt", "recreate");
fout.cd();
f_in->ls();
fout.Close();
but this code outputs the contents only into the root command line.
How should I do?
yus
2
Hi,
in ROOT6 you can do the following:
root [0] TFile* f_in = new TFile("sample.root");
root [1] .> mylog.txt
f_in->ls()
.>
root [4] .q
Now the output of f_in->ls()
is in the mylog.txt
.
2 Likes
GEN
3
It works! Thank you very much for your reply!
couet
4
In that particular case you can also use the ROOT command line rootls
at the shell prompt:
$ rootls sample.root > mylog.txt
1 Like
GEN
5
Thank you very much for your reply!
It’s so helpful:grin:
system
Closed
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.