Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node* init(FILE *input,node *head) {
- node *help = head,*temp=NULL;
- char c = 'a';
- while (c != EOF) {
- if (head == NULL) {
- head = malloc(sizeof(node));
- help = head;
- fscanf(input, "%s", &head->name);
- fscanf(input, "%d", &head->prisutnost);
- fscanf(input, "%d", &head->uticaj);
- fscanf(input, "%d", &head->otvorenost);
- fscanf(input, "%d", &head->izuzetnost);
- head->neu = countNew(head->prisutnost, head->uticaj, head->otvorenost, head->izuzetnost);
- head->old = countOld(head->prisutnost, head->uticaj, head->otvorenost, head->izuzetnost);
- head->next = NULL;
- }
- else {
- temp = malloc(sizeof(node));
- fscanf(input, "%s%d%d%d%d", &temp->name, &temp->prisutnost, &temp->uticaj, &temp->otvorenost, &temp->izuzetnost);
- temp->neu = countNew(temp->prisutnost, temp->uticaj, temp->otvorenost, temp->izuzetnost);
- temp->old = countOld(temp->prisutnost, temp->uticaj, temp->otvorenost, temp->izuzetnost);
- temp->next = NULL;
- help->next = temp;
- help = temp;
- }
- c = fgetc(input);
- }
- return head;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement