0
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    char c;
    ofstream outFile("/home/gnome/Music/file.txt", ios::out);
    while (cin >> c) {
        outFile.put(c);
    }
    outFile.close();

    return 0;
}

When I want to stop, I can't interrupt it with a control-D like I do on the the Linux terminal. How do I do this in eclipse. The issue is that, It doesn't write any char to my file. When I cat the file, it's empty, and the past data is gone. Empty. I used this code with g++ on the terminal, and it works. How do I use this in eclipse?

Console

Frank
  • 29
  • 4

0 Answers0