title: ifstream getline issue
body: <p>My code opens a text file, counts the number of lines, allocates an array to store all lines and then calls a function to fill this array with each line. This function file.getline calls return empty strings:</p>
  
  <p>Here's the code:</p>
  
  <pre><code>typedef char* line;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>char* filename=new char[256];
  cout &lt;&lt; "Type a file name: " &lt;&lt; endl;
  cin.ignore();
  cin.getline(filename,255);
  
  ifstream iFile(filename);
  
  int nLines=CountLines(iFile);
  
  line* LineArray = new line[nLines];
  ReadLines(LineArray,iFile);
  </code></pre>
  
  <p>CountLines function:</p>
  
  <pre><code>int CountLines(ifstream &amp;file)
  {
  line templine=new char[64];
  int nLines=0;
  
  while (!file.eof())
  {
      file.getline(templine,64);
  
      if (*templine != '\n')
          nLines++;
  
  }
  delete [] templine;
  
  return nLines;
  }
  </code></pre>
  
  <p>This works properly. ReadLines however does not:</p>
  
  <pre><code>void ReadLines(line* LineArray, ifstream &amp;file)
  {
      line templine=new char[64];
  
  file.seekg(0,ios::beg);
  
  int i = 0;
  while (!file.eof())
  {
  
      if (*templine != '\n')
      {
          LineArray[i]=templine;
          i++;
      }
  
  }
  delete [] templine;
  }
  </code></pre>
  
  <p>I have a feeling that it has something to do with the '\n' issue of getline but as I set the get pointer to 0 and the file starts with normal text and not a line, I can't understand why it fills templine with empty strings.</p>