Message: G4String: initialise with integer? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question G4String: initialise with integer? 

Forum: Run Management
Date: 29 Jun, 2005
From: I Cornelius <I Cornelius>

Hello, 
 Are there any plans to implement some type conversion (double &/or int to G4String)?
I would like to include things such as the run number etc in my output filenames. 
At the moment I am using c function sprintf to convert the integer to a c string. Something like:
char thickness[300];
sprintf(thickness, "%f", detector->GetThickness());
G4String Filename = "results" + thickness + ".dat";
It would be nice if there was some overloading of the G4String constructor to allow for type conversion so instead I could use:
G4String Filename = "results" + G4String(detector->GetThickness()) + ".dat";
, removing the need to use c-strings. 

Regards, Iwan

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

1 None: Re: G4String: initialise with integer?   (Makoto Asai - 29 Jun, 2005)
 Add Message Add Message
to: "G4String: initialise with integer?"

 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 ]