C++ examples for File Stream:stream
Read characters from File
#include <fstream> #include <iostream> using namespace std; int main()// www . j a v a 2 s. c om { char ch; //character to read ifstream infile("TEST.TXT"); //create file for input while( infile ) //read until EOF or error { infile.get(ch); //read character cout << ch; //display it } cout << endl; return 0; }