Hello Robert,
Check if the file is actually opened.
See the modified code.

---------- Forwarded message ----------
From: Robert Ryan <[EMAIL PROTECTED]>
Date: Aug 30, 2007 5:24 AM
Subject: [c-prog] no response
To: [email protected]

  why does this give no response

#include <string>
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;

int main() {
vector<string> words;
ifstream in("GetWords.cpp");
string word;

/**** Check if file is opened ****/

if(in.is_open() == 0) {
  cout << "Error: Failed to open the file" << endl;
}

/***********************************/

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 [~/] %

-Dipak


[Non-text portions of this message have been removed]

Reply via email to