I have to read a file input.txt which always has N lines. Each line consist of two integers. Specifically, I am reading a file where both integers are 2^(line_index -1).
int temp1, temp2;
std::vector<int> vec1, vec2;
std::fstream fh("input.txt", std::ios_base::in);
for (int i = 0; i < N; i++) {
fh >> temp1 >> temp2;
vec1.push_back(temp1);
vec2.push_back(temp2);
}
//first few lines of input are
//1 1
//2 2
//4 4
// . . .
//Line 31 should be: 2147483647 2147483647
//but my code read it as 2147483647 1073741824
//This is always the case for N>30
After line 30, as you can see on the snippet above, file reading became weird. Is there a problem in my code? Or my method of reading the file sort of limits the variable that I can input?