Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. void contact_from_file_to_list(s_linked_list *self) {
  2. FILE *file = fopen("test.txt", "r");
  3.  
  4. int sym;
  5.  
  6. s_contact *contact = contact_new();
  7. while(1) {
  8. sym = getc(file);
  9.  
  10. contact_read(contact, file);
  11. list_push_back(self, contact);
  12. contact_print(self->head->data);
  13. if (sym == EOF) {
  14. if(feof(file) != 0)
  15. break;
  16. }
  17. }
  18. fclose(file);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement