Robert Ryan a écrit :
> why does this give no response
>    
>   

Probably because you don't have a file named GetWords.cpp where you 
launch a.out
May be you can use String1.cpp instead or argv [1] if you supply it

futhermore, there is an alternative for your using using only STL functions
(let it a simple exercise for the reader ;) )

>   #include <string>
>   #include <iostream>
>   #include <fstream>
>   #include <vector>
>   using namespace std;
>   
>   int main() {
>     vector<string> words;
>     ifstream in("GetWords.cpp");
>     string word;
>     while(in >> word)
>       words.push_back(word); 
>     for(int i = 0; i < words.size(); i++)
>       cout << words[i] << endl;
>   } ///:~
>   
>   
>   
>   @sun [~/] % pico String1.cpp
>   @sun [~/] % g++ String1.cpp
>   @sun [~/] % a.out
>   @sun [~/] %
>   
>
>        

Reply via email to