title: How to read a specific line from file using fstream (C++)
body: <p>I'm a n00b C++ programmer, and I would like to know how to read a specific line from a text file.. For example if I have a text file containing the following lines:</p>
  
  <pre><code>1) Hello
  2) HELLO
  3) hEllO
  </code></pre>
  
  <p>How would i go about reading, let's say line 2 and printing it on the screen? This is what i have so far..</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      string sLine = "";
      ifstream read;
  
      read.open("input.txt");
  
      // Stuck here
      while(!read.eof()) {
           getline(read,1);
           cout &lt;&lt; sLine;
      }
      // End stuck
  
      read.close();
  
      return 0;
  }
  </code></pre>
  
  <p>The code in bewteen the comments section is where I'm stuck. Thanks!!</p>