string line; fstream fp(filename, ios::in); while(fp >> line) { cout << line; } fp.close();