It really depends on what all your fomatting rules are.
I don't understand exactly how you know when you are missing a month.
Sometimes there are 2 spaces between two values sometimes 3.
If 2 spaces means you are missing one month what does 3 spaces mean?
Anyway, I would step through character by character and decide what you need to do. Of course you'll have to modify this fit your rules
Code:while( (fscanf( input, "%c", &holder ) != EOF) ) { if(holder == ',') //replace comma with tab { fprintf( output, "%c", '\t' ); prev_holder = holder; } else if(prev_holder == ' ' && holder == ' ') // two consecutive spaces, replace 2nd with asterick { fprintf( output, "%c", '*' ); prev_holder = '*'; //if 3 spaces means missing 2 months, which I'm guessing it does, this instead //fprintf( output, "%s", "* " ); //prev_holder = holder; //can be moved outside if statments since always the same } else { fprintf( output, "%c", holder ); //just print the character prev_holder = holder; } }



LinkBack URL
About LinkBacks


