Outputting multiple lines to a text file
<p>I've done this before, but can't find the sample code...still new to c++.</p>

<p>I need to output multiple lines to a text file.  Right now it only outputs the last line, so I assume its overwriting the prior line each time the loop is run.  How do I get it to output a line and then output to the next line, etc. without writing over the prior line?</p>

<p>Here's a snippet:</p>

<pre><code>    int main()
{
    int n = 1;

    while (n &lt;= 100)
    {
        int argument = 0 + n;

        ofstream textfile;
        textfile.open ("textfile.txt");
        textfile &lt;&lt; argument &lt;&lt; endl;
        textfile.close();

        ++n;
    }

    return 0;
}
</code></pre>
