Message: output file is overwritting ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question output file is overwritting ? 

Forum: Analysis
Date: 18 Nov, 2015
From: Medoo Saudi <Medoo Saudi>

Dear All

I have tried to print my data in output file but it is just write the last data only as it is overwrite the data .

// open output file

ofstream runfile1 ("output.out");

runfile1 << "-------------------------------------------------------" << G4endl;
runfile1 << " 		geant4 tatorial example  		" << G4endl;
runfile1 << "--------------------------------------------------------------------"<< G4endl;
runfile1 << "Position of Interaction(cm)			Scattered Energy(KeV)	"<< G4endl;
runfile1 << "P= " << positionpost/CLHEP::cm << "\t\t\t\t" << "E= "<< kinEnergy/CLHEP::keV << G4endl;

any help is appreciated .

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

1 Ok: Re: output file is overwritting ?   (Medoo Saudi - 19 Nov, 2015)
 Add Message Add Message
to: "output file is overwritting ?"

 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 ]