Setting a value from function parameter const string(&)
<p>Very noobish, simple question, which hopefully has an easy answer. My issue basically comes down to a single line of code on a function parameter that is:</p>

<pre><code>void className::read(const string &amp;)
{
  ifstream fin;
  fin.open(fname);
  /* ...function code */
  fin.close()
}
</code></pre>

<p>The input is established in main as a string, fname (i.e. <code>object.read(fname)</code>). 
When I do this, it tells me that fname has not been declared in this scope. My question, thus,  is how to use fname, the input, as the file name in fin.open().
Thanks to everyone who has already helped and sorry for the poor explanation of the issue earlier. </p>
