Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ReadData(FILE* fin, Vertex* V,int nDim)
- {
- char znak;
- int i = 0;
- while ((znak = getc(fin)) != EOF)
- {
- fscanf(fin, "%d", &i);
- List* b = (List*)calloc(1, sizeof(List));
- if (!b)
- {
- printf("Can't allocate memory");
- return;
- }
- if (!(V[i].nList))
- {
- fscanf(fin, "%d", &V[i].Type);
- V[i].nList = b;
- V[i].nList->nKey = i;
- fscanf(fin, "%d", &(b->target));
- fscanf(fin, "%lf", &(b->length));
- }
- else
- {
- List* a = V[i].nList;
- fscanf(fin, "%d", &V[i].Type);
- while (a->pNext)
- a = a->pNext;
- a->pNext = b;
- fscanf(fin, "%d", &(b->target));
- fscanf(fin, "%lf", &(b->length));
- b->nKey = i;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement