Message: Re: Can G4cout write to screen and file simultaneously? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Can G4cout write to screen and file simultaneously? 

Keywords: G4cout output stream redirection file screen buffer
Forum: Event and Track Management
Re: Question Can G4cout write to screen and file simultaneously? (Blair Smith)
Date: 25 May, 2005
From: Tore Ersmark <Tore Ersmark>

Hi Blair,

You can replace the stream buffer used by cout by a custom one. There
you can do what you want (write to a file) in addition to sending
everything to the original cout stream buffer. (You probably want to
do the same thing for cerr).

I learned how to do this from
http://groups-beta.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81

In my case I write everything that goes on cout to an object in a
root-file. Works great, and it is very useful to have the Geant4
text-output logged in the same file as the data from my runs.

Good luck!

Cheers,
Tore

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: Can G4cout write to screen and file simultaneously?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]