#include #include #include #include ofstream fout; // see man fstream FILE * fff; // C FILE pointer int main() { char temps[99]; fout.open("myout.dat", ios::out); fout << "Hello there" << endl; fout << "Line2" << endl; fout << "Line 3\n" << "line 4" << endl; fout.close(); cout << "=== === ===\n"; system("cat -n myout.dat"); cout << "=== === ===\n"; cout << "===== ===== =====" << endl; fff = fopen("myout.dat","rt"); // how to check if fopen ok? while(! feof(fff) ){ fgets(temps, 88, fff); cout << temps << endl; } cout << "===== ===== =====" << endl; fclose(fff); }