title: Trying to print contents of vector
body: <p>I've been trying to get more and more comfortable with C++ and I've moved to trying to write some file manip stuff. I was halfway through something that would be able to parse fasta files and I got a little stuck:</p>
  
  <pre><code>#include&lt;fstream&gt;
  #include&lt;iostream&gt;
  #include&lt;string&gt;
  #include&lt;vector&gt;
  
  using namespace std;
  
  //A function for reading in DNA files in FASTA format.
  void fastaRead(string file)
  {
      ifstream inputFile;
      inputFile.open(file);
      if (inputFile.is_open()) {
          vector&lt;string&gt; seqNames;
          vector&lt;string&gt; sequences;
          string currentSeq;
          string line;
          while (getline(inputFile, line))
          {
              if (line[0] == '&gt;') {
                  seqNames.push_back(line);
              }
          }
      }
      for( int i = 0; i &lt; seqNames.size(); i++){
          cout &lt;&lt; seqNames[i] &lt;&lt; endl;
      }
      inputFile.close();
  }
  
  int main()
  {
      string fileName;
      cout &lt;&lt; "Enter the filename and path of the fasta file" &lt;&lt; endl;
      getline(cin, fileName);
      cout &lt;&lt; "The file name specified was: " &lt;&lt; fileName &lt;&lt; endl;
      fastaRead(fileName);
      return 0;
  }
  </code></pre>
  
  <p>The function should go through a text file like the one below:</p>
  
  <pre><code>Hello World!
  &gt;foo
  bleep bleep
  &gt;nope
  </code></pre>
  
  <p>and identify the ones beginning with '>' and push them onto the vector seqNames and then report back the contents to the command line. - So I'm trying to write the ability to detect fast format heads.
  However when I compile I am told:</p>
  
  <pre><code>n95753:Desktop wardb$ g++ testfasta.cpp
  testfasta.cpp:25:25: error: use of undeclared identifier 'seqNames'
      for( int i = 0; i &lt; seqNames.size(); i++){
                          ^
  testfasta.cpp:26:17: error: use of undeclared identifier 'seqNames'
          cout &lt;&lt; seqNames[i] &lt;&lt; endl;
  </code></pre>
  
  <p>However I'm pretty sure I declared the vector in the line:
  <code>vector&lt;string&gt; seqNames;</code></p>
  
  <p>Thanks,
  Ben.</p>