Im trying to get a list of words off a text file into an iterator. I tried using the copy function from fstream but i havent had any luck.
any ideas what im doing wrong?Code:#include<iostream> #include <fstream> #include<iterator> #include<algorithm> #include<string> #include <vector> using namespace std; int main() { string word; ifstream infile("dictionary.txt"); istream_iterator< string > in(infile); istream_iterator< string > eos; vector< string > dictionary; copy(in,eos,back_inserter(dictionary)); cout<<dictionary.size(); return 0; }