title: Reading in a simple text file & writing it to another text file with leading blanks and blank lines removed
body: <p>I want to keep this code but now I am just wondering if there is a way when i read in the file in my while loop if i can remove the blanks within that loop</p>
  
  <p>I am having a ton of problems with removing blanks 
  I do not have a large understanding on reading in files 
  to my program so this has been very 
  difficult for me, can anybody tell me where 
  I am making my mistakes?  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cassert&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;cstdio&gt;
  
  using namespace std;
  
  int main (void)
   {
   int i=0;
   int current=0;
   int len;
   int ch;
   string s1;
   string s2;
   ifstream fileIn;
    cout &lt;&lt; "Enter name of file: ";
    cin &gt;&gt; s1;
    fileIn.open(s1.data() );
     assert(fileIn.is_open() );
  
   while (!(fileIn.eof() ) )
    { ch=fileIn.get();
    s1.insert(i,1,ch);
    s1.end(); 
    i++;}
  
  
  
  cout &lt;&lt; s1;
  len=s1.length();
  cout &lt;&lt; len;
  
   while (current &lt; len-1)
      {
          if (!(s1[current] == ' ' &amp;&amp; s1[current + 1] == ' ') &amp;&amp;
              !(s1[current] == '\n' &amp;&amp; s1[current + 1] == '\n')
              )
          {
              s2.append(s1[current]);
          }
  
          current++;
  
      }
  
   return 0;
   }
  </code></pre>