Write scan ouput in a txt file

could you tell me how to write in a txt file the output of TTree scan function? Thanks.

I find the solution [url=https://root-forum.cern.ch/t/dumping-ttree-variables-to-a-file/7517/1 Sorry for the inconvenience. :confused:

In fact, I have another question concerning this “issue”.
How can I adapt

in a macro file.
I have an output file defined with ofstream

How can I redirect the output of tree.scan() to output?

does not seem to work. :confused:

For information, answer is given [url=https://root-forum.cern.ch/t/redirecting-scan-output-to-a-text-file/11314/1