Backup of stdout

Dear Rooters,

I have the following problem, I am sure you can help.

Let us suppose I execute some macro in a root session,
sending the stdout to a log file with

root -b -q macro.C >macro.log

In my case, the file macro.C features some parameters,
and I would like to keep the information on these parameters
into the name of the log file.

In other words, if the parameter is X, I would like to
have the following:

root -b -q macro.C (with, say, parameter X=5)

and find the stdout copied in a log file like

macro_5.log

In still other words, I would like to backup the content of stdout
into a file macro_5.log, by writing some lines of code inside macro.C.
Maybe with freopen?

Thank you so much.
Ciaociao,
D

Hi,

if you’re working on a UNIX flavored machine you should be able to simply move the file from inside the script. See gSystem->Rename(“macro.log”,“macro_5.log”). Once the macro call has finished macro.log should only be visible as macro_5.log.

Axel.

Yes, simple and effective.
Thanks a lot,
D