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
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?
#include <iostream>
#include <cassert>
#include <string>
#include <fstream>
#include <cstdio>
using namespace std;
int main (void)
 {
 int i=0;
 int current=0;
 int len;
 int ch;
 string s1;
 string s2;
 ifstream fileIn;
  cout << "Enter name of file: ";
  cin >> s1;
  fileIn.open(s1.data() );
   assert(fileIn.is_open() );
 while (!(fileIn.eof() ) )
  { ch=fileIn.get();
  s1.insert(i,1,ch);
  s1.end(); 
  i++;}
cout << s1;
len=s1.length();
cout << len;
 while (current < len-1)
    {
        if (!(s1[current] == ' ' && s1[current + 1] == ' ') &&
            !(s1[current] == '\n' && s1[current + 1] == '\n')
            )
        {
            s2.append(s1[current]);
        }
        current++;
    }
 return 0;
 }
 
     
     
    