What if you have this struct:
struct Speckeeper
{
Iceint icespec[3]; //not all three are always used
string name;
};
Now say you have this function:
void stupidfunction(string &strfun, ifstream &infile)
{
int ix;
strfun="Data/";
ix=5;
while(strfun[ix-1]!=' '&&ix<20)
{
strfun+=infile.get();
ix+=1;
}
strfun.resize(ix-1);
}
Could you go like this?:
Speckeeper skulls;
ifstream dumbfile;
stupidfunction(skulls.name, dumbfile);
What I'm pointing out is the the string is pass by reference in that function. So does that mean after stupidfunction goes out of scope the value of skulls.name will be changed?