blob: 1e9f30af7c6caa80c94828b6680ed6ed76a6e3a7 [file] [log] [blame] [edit]
#include <iostream>
#include <fstream>
#include <string>
#include <errno.h>
using namespace std;
int main() {
string line;
ifstream myfile;
errno = 0;
myfile.open("hello.txt", ifstream::in);
if (errno)
perror("Unable to open (hello.txt):");
if (myfile.is_open()) {
while (myfile.good()) {
getline(myfile, line);
cout << line << endl;
}
myfile.close();
cout << "Stream test passed" << endl;
} else {
cout << "Unable to open file";
}
return 0;
}