#include <iostream> #include <fstream> using namespace std; int main(int argc, char *argv[]) { char ch; ifstream in("test", ios::in | ios::binary); if(!in) { cout << "Cannot open file.\n"; return 1; } while(in) { // in will be false when eof is reached in.get(ch); if(in) cout << ch; } in.close(); return 0; }
hello