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.
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.