How do I use fstream (specifically ofstream) through a functions parameters
<p>Hi I'm a <code>c++</code> beginner and this is one of my assignments and I'm a bit stuck. This isn't my entire code it's just a snippet of what I need help with. What I'm trying to do is have one function dedicated to exporting everything with that function into a <code>text</code> file which is called results.txt. So the line "does this work" should show up when I open the file, but when I run the file I get errors like </p>

<blockquote>
  <p>"Error C2065: 'out' : undeclared identifier"</p>
  
  <p>"Error C2275: 'std::ofstream' : illegal use of this type as an expression"</p>
  
  <p>"IntelliSense: type name is not allowed" </p>
  
  <p>"IntelliSense: identifier "out" is undefined"</p>
</blockquote>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;


using namespace std;

//prototypes
void output(ofstream&amp; out);

int main()
{
output(ofstream&amp; out);
    ifstream in;
    in.open("inven.txt");
    ofstream out;
    out.open("results.txt");
return 0;
}

void output(ofstream&amp; out)
{
out &lt;&lt; "does this work?" &lt;&lt; endl;
}
</code></pre>

<p>Right now it's really late and I'm just blanking out on what I'm doing wrong.</p>
