A very simple program: read a file line by line (each line contains integer) then do something and write the output to a file.
int main()
{
ifstream fin ("f:\in.txt");
ofstream fout ("f:\out.txt");
int a;
while (fin >> a) {
int b = (a >> 6) & 255;
fout << b << endl;
}
return 0;
}
The input as multiple lines like this:
93859312
2635577168
2929619024
312396812
3019231016
3139200356
...
But the while
loops is iterated only one time!! and output only contains
183
Which corresponds to the first input line. Why???