I have a quick question...I'm sorting an array with only numbers in it, two per line. I wanna flush the first string of non-numbers and the other value in that line, if there is one of course, whether it was the first or last, and continue on with the sort. I started a while loop...
I'm wondering if, at the end I should I make c != '\n' and my count can't equal 2? Would that do it? Because if my count is 0, that should flush the line, or if it's 1, that should flush the line, and if its not already two, it gets sent to this flush function.Code:char flush (int count, FILE* fp) { char c; printf("Line %d is invalid, skipping line.\n", count); while (((c = fgetc(fp)) != EOF && (c != '\n'))); return c; }
Am I trying to add too much to one loop?
Thanks, gator



LinkBack URL
About LinkBacks




