Message: output file using ostream Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question output file using ostream 

Forum: Processes Involving Optical Photons
Date: 12 Sep, 2011
From: Lilia Drakopoulou <Lilia Drakopoulou>

Hello!

I want to have my results in an output file so I used the following code:

#include "MySession.hh"
#include "globals.hh"
#include "G4ios.hh"
#include "G4Types.hh"
#include <iostream>
#include "G4coutDestination.hh"

MySession::MySession() {}

MySession::~MySession() {}

  ostream logFile;
  logFile.open("MylogFile");

G4int MySession::ReceiveG4cout(G4String coutString)
{
  logFile << coutString << flush;
  return 0;
}

But it turns out this message and I really can't solve it. Any suggestion how to make it work?

src/MySession.cc:15:3: error: ‘ostream’ does not name a type

src/MySession.cc:16:3: error: ‘logFile’ does not name a type

src/MySession.cc: In member function ‘virtual G4int MySession::ReceiveG4cout(G4String)’:

src/MySession.cc:20:3: error: ‘logFile’ was not declared in this scope

src/MySession.cc:20:28: error: ‘flush’ was not declared in this scope

Thank you in advance!

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

1 Ok: Re: output file using ostream   (Lilia Drakopoulou - 13 Sep, 2011)
1 Question: Re: output file using ostream   (Steve Asztalos - 14 Sep, 2011)
2 Question: Re: output file using ostream   (Pierre - 11 Jul, 2014)
1 More: Re: output file using ostream   (Gumplinger Peter - 15 Jul, 2014)
2 Feedback: Re: output file using ostream   (Neil Fazel - 14 Sep, 2011)
 Add Message Add Message
to: "output file using ostream"

 Subscribe Subscribe

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