Is it possible to ignore scanf()
in a while
loop if a certain character was scanned?
For example:
int i = 0;
char b = 32;
while (scanf("%c", &b) == 1) {
if (b == '\n') {
printf("r");
}
i++;
}
output after pressing enter: "r". output after pressing whitespace+enter: "r". But here I expect no output! I want the output only when an enter is pressed and nothing before!