diff --git a/du5/program.c b/du5/program.c index 83567bf..91e6151 100644 --- a/du5/program.c +++ b/du5/program.c @@ -20,20 +20,23 @@ int main(){ int size = 0; while(1){ - char line[SIZE]; - memset(line,0,SIZE); - char* r = fgets(line,SIZE,stdin); - if (r == NULL){ + char line[SIZE]; + memset(line,0,SIZE); + char* r = fgets(line,SIZE,stdin); + if (r == NULL){ // Nastal koniec načítania break; } char* end = NULL; int value = strtol(line,&end,10); - if (value == 0){ + if (value == 0&&line[0]=='\n'){ // Premena sa nepodarila break; - } + }else if(value==0&&line[0]!='\n'){ + printf("Nepodarilo nacitat nic\n"); + return 0; + } char *name=end+1; int id = find_student(databaza,size,name);