I am trying to convert a string I read in from a file to an int value so I can store it in an integer variable. This is what my code looks like:
ifstream sin
You can do atoi(line.c_str())
atoi(line.c_str())
Another approach, using C++ streams, is:
stringstream ss(line); unsigned int year; ss >> year;