In a text file I will have a line containing a series of numbers, with each number separated by a space. How would I read each of these numbers and store all of them in an arra
Just copy them from the stream to the array:
#include #include #include #include int main() { std::ifstream file("filename"); std::vector array; std::copy( std::istream_iterator(file), std::istream_iterator(), std::back_inserter(array)); }