I'm trying to figure out how to get numbers from files, and while I can read the numbers and convert them to integers, I run into issues when trying to read multiple integers separated by spaces. Here is the code.
I'm wanting it to print the contents of the file ("10 20 30 40 50 60 70 80 90", without quotes) each separated with a newline, but it instead prints every other number and terminates in an error when it attempts to read beyond the end of the file. I think this has something to do with seekg(). If I put an extra three spaces between each number it prints fine, but I don't know why.