Hi..
I want to compress a text file which is like this:(input.txt)
ffa11 ffb13 ffd2 e c e r
and save the result in (output.txt)
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
char ch;
int counter=0;
fstream infile;
fstream outfile;
infile.open( "input.txt",ios::in );
outfile.open( "output.txt",ios::app );
infile.unsetf( ios::skipws );
do
{
infile>>ch;
if( ch=='f' )
{
infile>>ch;
infile>>ch;
infile>>counter;
for( int i=counter; i<0; i-- )
{
outfile<<ch;
}
}
else
{
outfile<<ch;
}
}while( !infile.fail() );
outfile<<endl;
return 0;
}
the problem is its not printing the a's, b's, d's
please help???