string assignment error

Daeron

Limp Gawd
Joined
Aug 7, 2000
Messages
253
Ok, this is a wierd error. Here's sample code:

class sample
{
friend istream& operator >> (istream& ins, sample& test);
private:
string name
};

istream& operator >> (istream& ins, sample& test)
{
getline(ins, test.name); //error here
return ins;
}

Once the program gets to the getline statement, I get an access violation 0xc0000005 error. I've tried creating a temp string var using the getline with it, then copying temp into name but then it errors out on that line. Any help would be greatly appreciated.
 
Further troubleshooting shows that for some reason, the member variable of type string is stuck in a FROZEN state and it errors out on the GROW function. Anyone know why it would be in this state? The parameter isn't a const, and I even made the member variable a public and same thing. I'm scrappin the bottom of the barrel here.
 
Back
Top