Root does not redirect command to a given file

Dear Root users, i’m in trouble right now. I built a .C program and I want it to write all its outputs in a .log file. I’m now using the last version of Root (6.10), but the command .> does not work.

The terminal, in fact, stucks like in the image and the output file gets some weird symbols. i tried to combine it in many ways, like the following but it does not work.

root [1] .> output.log .x myfile.c("inputfile.txt")

root [1] .x myfile.c("inputfile.txt") .> output.log 

root [1] .> output.log
.x myfile.c("inputfile.txt")

and so on…

$ root
   ----------------------------------------------------------------
  | Welcome to ROOT 6.11/03                    http://root.cern.ch |
  |                                   (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                             |
  | From heads/master@v6-11-02-626-gd02d187, Nov 07 2017, 10:24:29 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'     |
   ----------------------------------------------------------------

root [0] .> hpx.dat 
hpx->Print()
.>
root [3] .! cat hpx.dat
root [1] hpx->Print()
TH1.Print Name  = hpx, Entries= 25000, Total sum= 24997
root [2] .>
root [4] 

Don’t know what this means, but I tried to copy your sequence of commands and it gave me this.

$ root
   ------------------------------------------------------------
  | Welcome to ROOT 6.10/08                http://root.cern.ch |
  |                               (c) 1995-2017, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tag v6-10-08, 16 October 2017                         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] .> hpx.dat
hpx->Print()
input_line_9:2:3: error: use of undeclared identifier 'hpx'
 (hpx->Print())
  ^
.>
root [3] .! cat hpx.dat
root [1] hpx->Print()
root [2] .>
root [4] 

I just printed one of my histogram to generate an output … Just do:

root [0] .> filename
... some root command generating output ...
.>

then you are back to the root prompt and the file filename contains the output.

Thank you for the help. Now the program prints the output correctly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.