Hello, I can not read 8 values from the file (1 2 3 4 5 6 7 8).
#include <fstream> #include <iostream> using namespace std; int main() { ifstream f ("file.txt"); for (int i=0; i<8; i++) { int a; f >> a; cout << a << endl; } return 0; }
Console output:
2665544 2665544 2665544 2665544 2665544 2665544 2665544 2665544
SUCCESSFUL
(total time: 136ms)
I work in NetBeans. The file itself is in the project folder.
What am I doing wrong? Thank.