This commit is contained in:
Andrii Hermaniuk 2022-04-07 16:53:51 +02:00
parent 14855a54d4
commit 0e205349ec

View File

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