title: C++ compression method for txt file
body: <p>I need to create a function that counts chars in a string in C++, for example, when reading in from a text file that contains:
  "aaabbbbbggssj"
  the output should be:
  "3a5b2g1j"</p>
  
  <p>Im really not sure how to go about it and any help would be greatly appreciated! Thanks</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  #include "Character.h"
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main(){
    int c;
    void count(char [], int []);
  //opening text file
    string line = " ";
    fstream my_stream;
    my_stream.open("information.txt");
  //loop to cout occurences of each character
    while (getline (my_stream,line))
    {
      cout &lt;&lt; line &lt;&lt; '\n';
      c += line.length();
      cout &lt;&lt; c;
  
      int numOfChars = line.length();
  
      for (unsigned int i = 0; i &lt; line.length(); i++){
  
    }
    my_stream.close();
    return 0;
  }
  </code></pre>