Note that this:


while(!file.eof())
{
getline(file, str);
cout << str << endl;
}

is not the proper way to read through a file. The end-of-file condition is only set after an...