the program is only viewing one char at a time, which is fine for transfering data. But if you want to edit out any back to back space characters then you need some mechanism to keep track of the last char seen too. Then if current char is a space char and the last char is a space char you will ingnore the current char. Another variable of type char will probably do it.
Code:
void EditFile(ifstream& InStream, ofstream& OutStream)
{
char current;
char previous;
InStream.get(current);
OutStream << current; //first char is free, can't be back to back spaces
while ( ! InStream.eof())
{
previous = current;
InStream.get(current);
if (current != ' ')
{
Outstream << current;
}
else if(current == ' ' && previous != ' ')//first space saved
{
Outstream << current;
}
else if(current == ' ' && previous == ' ')//back to back spaces aren't
{
cout << "found back to back space" << endl;
}
}