Hi bbcc,
I am a little puzzled as to what you are trying to do here.
You say that you want to copy the first ``room'' (element?) of the G4String
name
into the first room of another G4String
filename
. Therefore,
name
and
filename
are both
G4String
objects, and hence, the above is not what you want. As Framework says, this will only work...
Assuming that fileName is an array of G4Strings |
the key word being ``Array'', which I gather is not applicable in this case.
It seems that you are trying to use reference operators to initialise a G4String, called
filename
, using another
G4String
, called
name
, and that you will later use
filename
to initialise an
istream
object bound to a data file.
If this is so, why not just initialse the
istream
object using a
const char*
:
1 2
|
const char* name = "path/to/my/file.txt";
ifstream infile(name);
|
All this is doing is passing the address of the first element of the char array to the
ifstream
constructor. In other words, the above is identical to this:
1 2
|
const char* name = "path/to/my/file.txt";
ifstream infile(&name[0]);
|
So you don't really need to worry about using & to construct istream objects since you can do:
|
ifstream infile("path/to/my/file.txt");
|
Hope that helps. Good luck!