I have a strange problem that seems to happen when I pass an ifstream by reference.
In my main method, I have created an ifstream, and then I pass it to this read method by reference:
void ArrayStorage::read(ifstream& fin)
{
if (fin.is_open())
{
string input;
getline(fin, input, '\n');
}
else
{
}
}
This should work fine, however, I'm getting the following message in the value of the ifstream:
- fin {_Filebuffer={_Set_eback=0xcccccccc _Set_egptr=0xcccccccc ...} } std::basic_ifstream > &
Anyone have any ideas?
EDIT: Code that calls the method:
ifstream fin1("data.txt");
ofstream out1("1-In-SortedRead.txt");
if(!fin1.is_open())
{
cout << "FAIL" << endl;
return 1;
}
ArrayStorage arrayStorage1;
// read in values into data structure
arrayStorage1.read(fin1);