hey,
i was having some troubles printing the contents of a file to screen..this is what ive got...for some reason nothing get printed..
thanks for any helpCode:int parser::readFile(void) {
string filename="data.txt";
string line;
ifstream file(filename.c_str());
if(!file.is_open()) {
cout << "Error...file is not opened" << endl;
return 0;
}
else
return 1;
while (!file.eof()) {
getline(file, line);
cout << line << endl;
}
file.close();
}