Hello, I am trying to write a program that copies the 21st character of each line, excluding spaces. And if the line has less than 21 character to just copy the last character. So far, I can do all of that, but I just need to exclude the spaces and put all my results on 1 line in my new file. I just can't figure out what I'm missing. This is what I have so far.
whiteSpace is being used as true/false it is whiteSpace = 0; up top, by the way.
Thank you!Code:while ((curCh = fgetc(sp1)) != EOF){ countCh++; if(curCh == ' ') whiteSpace = 0; if(curCh == '\n' ){ if (countCh < 21 && whiteSpace != 0) fputc (preCh, sp2); countCh = 0; } whiteSpace = 1; if ( countCh == 21 && whiteSpace != 0){ fputc(curCh , sp2);



1Likes
LinkBack URL
About LinkBacks



