Direction to documentation for instruction

Hello. Inside a for loop I need to read in five numbers from five columns in the current row. Can someone please direct me to documentation to do this using only #include <iostream>, #include <iomanip>, #include <stdlib.h>. No Vectors. No Arrays. Just simple redirection for input/output from a .txt file. Thanks

so your txt file is formatted like
1
2
22 33 44 55 888
1  983 89 5 36
?

1
2
3
4
5
6
7
//reads one row
for (int i = 0; i < 5; i ++)
{
    int n;
    f >> n;
    std::cout << n << std::endl;
}


I feel like the tutorial on this site should give a basic code example of this, I'm surprised it doesn't, although it does say that the stream operators can be used just like std::cout and std::cin.
http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
The direction is intuitive because it's like information is being transferred from the file f to the variable.
Last edited on
Topic archived. No new replies allowed.