diff --git a/du3/program.c b/du3/program.c index dd930f2..9fb6dfd 100644 --- a/du3/program.c +++ b/du3/program.c @@ -20,11 +20,12 @@ int main(){ int pos = -1; //float p = 0; while(stop == 0){ - r = fgets(riadok,LINE_SIZE,stdin); - pos++; + r = fgets(riadok,LINE_SIZE,stdin); if(feof(stdin)){ break; } + pos++; + if (r == NULL || !isdigit(*r) || *r == EOF || feof(stdin)) { //printf("%d", *r); if(*r == 10){