title: how to count the characters in a text file
body: <p>im trying to count the characters inside a text file in c++, this is what i have so far, for some reason im getting 4. even thou i have 123456 characters in it. if i increase or decrease the characters i still get 4, please help and thanks in advance</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  const char FileName[] = "text.txt";
  
  int main () 
  {
  string line;
  ifstream inMyStream (FileName); 
  int c;
  
  if (inMyStream.is_open()) 
  {
  
       while(  getline (inMyStream, line)){
  
               cout&lt;&lt;line&lt;&lt;endl;
                c++;
    }
      }
      inMyStream.close(); 
  
  system("pause");
     return 0;
  }
  </code></pre>