Skip to content

Commit 7ae8040

Browse files
committed
Tweaked version of count.c
- Legacy-Id: 13514
1 parent d20e6ce commit 7ae8040

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

bin/count.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ int main( void )
1010
setvbuf(stdout, NULL, _IONBF, 0);
1111
setvbuf(stderr, NULL, _IONBF, 0);
1212

13-
c = getchar();
13+
c = fgetc(stdin);
1414
while(c != EOF)
1515
{
1616
if (c == '.') count++;
17-
putchar(c);
17+
fputc(c, stdout);
18+
fflush(stdout);
1819
if ( count % 76 == 0) {
1920
fprintf(stderr, "%4d", count);
21+
fflush(stderr);
2022
}
21-
c = getchar();
23+
c = fgetc(stdin);
2224
}
2325
return 0;
2426
}

0 commit comments

Comments
 (0)