C++ examples for File Stream:stream
Using Code to Open a File and Read from It
#include <iostream> #include <fstream> #include <string> using namespace std; int main() // w w w .j ava 2 s . co m { string word; ifstream infile("../MyFile.txt"); infile >> word; cout << word << endl; infile.close(); return 0; }