Line | |
---|
1 | README G4cout_test01: |
---|
2 | |
---|
3 | Nov. 09 2002 |
---|
4 | H. Yoshida |
---|
5 | update for Geant4.4.1 |
---|
6 | |
---|
7 | This example program illustrates how to use "setCoutDestination" of G4cout |
---|
8 | in order to redirect the stream between two sessions. Usually the constructor |
---|
9 | of a UI class, f.e., G4UIterminal, does setCoutDestination(this) and |
---|
10 | the destructor does setCoutDestination(NULL). |
---|
11 | By explicitly using setCoutDestination, user can redirect G4cout/cerr to one of |
---|
12 | the sessions opened. |
---|
13 | |
---|
14 | This example is created after examples/novice/exampleN01 which is a pure batch |
---|
15 | one. But this example has an interactive session G4UITerminal(new G4UItcsh) and |
---|
16 | another session "MySession" to redirect the output to a file named "Mylog". |
---|
17 | |
---|
18 | |
---|
19 | At first, G4UItcsh is instantiated to provide an interactive session. |
---|
20 | When user types in "exit" command, G4UItcsh session is closed, and |
---|
21 | then MySession is used so that all subsequent G4cout/cerr are saved |
---|
22 | in the file "Mylog". |
---|
23 | |
---|
24 | Finally both instances are deleted and the last messages are shown |
---|
25 | on the default display. |
---|
26 | |
---|
27 | Note that when there is no instance of UI sessions, G4cout/cerr are sent to |
---|
28 | the display by default. |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.