strings and output files

I am supposed to create a program which accepts input until the user hits the enter key, and this input is to be output to a .txt file. Here is what I wrote:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main ()
{
string message;

cout << "Enter a message: ";

getline(cin,message);

ofstream outFile;

outFile.open("output.txt");

return 0;
}

The program runs, and it creates a file, but it's a blank file. I'm guessing I'm missing some steps in this program. I am supposed to save the string somehow before outputting it? How would I do this?
You are opening the file, but you aren't writing anything to it.

Add outFile << message after you open the text file.
Topic archived. No new replies allowed.