im learning C++ from a C background.
What i want to do is copy the console input to a file. For this proupouse i do this:
 #include "stdafx.h"
 #include <fstream>
 #include <iostream>
 using namespace std;
 int main()
 {
     ofstream file_out;
     file_out.open("test.txt");
     char char_input;
     while (!cin.eof())
     {
         cin.get(char_input);
         file_out << char_input;
     } 
     file_out.close();
     return 0;
}
The thing is that works right execpt that the last line isn't in the output file. I.E: if i enter
Hello
My Name Is
Lucas
Goodbye!
The "Goodbye" doesn't appear in the file only
Hello
My Name Is
Lucas
Thxs in advance.
 
     
    