Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. void ReadData(FILE* fin, Vertex* V,int nDim)
  2. {
  3. char znak;
  4. int i = 0;
  5. while ((znak = getc(fin)) != EOF)
  6. {
  7. fscanf(fin, "%d", &i);
  8. List* b = (List*)calloc(1, sizeof(List));
  9. if (!b)
  10. {
  11. printf("Can't allocate memory");
  12. return;
  13. }
  14. if (!(V[i].nList))
  15. {
  16. fscanf(fin, "%d", &V[i].Type);
  17. V[i].nList = b;
  18. V[i].nList->nKey = i;
  19. fscanf(fin, "%d", &(b->target));
  20. fscanf(fin, "%lf", &(b->length));
  21.  
  22. }
  23. else
  24. {
  25. List* a = V[i].nList;
  26. fscanf(fin, "%d", &V[i].Type);
  27. while (a->pNext)
  28. a = a->pNext;
  29. a->pNext = b;
  30. fscanf(fin, "%d", &(b->target));
  31. fscanf(fin, "%lf", &(b->length));
  32. b->nKey = i;
  33. }
  34.  
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement