I find this hard to believe! The following code works fine:
Code:
#include <fstream>
#include <string>
#include <iostream>
int main()
{
std::fstream file("data.dat", std::ios::in);
std::string name, days;
int crn, start, end;
file >> name >> crn >> start >> end >> days;
std::cout << "name = " << name << "\n"
<< "days = " << days << "\n"
<< "crn = " << crn << "\n"
<< "start = " << start << "\n"
<< "end = " << end << std::endl;
}
The "data.dat" contains the same data as you posted.