Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Marks(FILE* S)
- {
- char ch[1];
- ch[0] = fgetc(S);
- printf("\n ch! = %c\n ", ch);
- Node* tmp = (Node*)malloc(sizeof(Node*));
- int* a = NULL;
- int* b;
- int i = 0;
- int k = 0;
- if (!feof(S))
- {
- do
- {
- if (ch[0] == '/')
- {
- continue;
- }
- b = (int*)realloc(a, (i + 1) * sizeof(int));
- a = b;
- *a = atoi(ch);
- printf("%d", *a);
- i++;
- k++;
- } while (((ch[0] = fgetc(S)) != '#') && (!feof(S)));
- tmp->marks = a;
- tmp->k = k;
- //printf("Vivod k = %d", k);
- }
- }
- //чтение файла
- void readfile(List* list, FILE *S)
- {
- fopen_s(&S, "input.txt", "rt");
- Node* tmp = (Node*)malloc(sizeof(Node));
- char * tmpc;
- tmp->data = (char*)malloc(1000);
- while (!feof(S))
- {
- //фамилия
- tmpc = tmp->data;
- int ch;
- while(((ch = fgetc(S)) != ' ') && (!feof(S)))
- {
- *(tmpc) = ch;
- tmpc++;
- printf("end");
- }
- *(tmpc) = '\0';
- // оценки
- Marks(S);
- tmp->next = NULL;
- if (list->head == NULL)
- {
- list->head = tmp;
- //printf("UHJH");
- }
- else
- {
- Node* last = getLastNodeIfNotEmpty(list);
- last->next = tmp;
- //printf("UHJHlsdfgs");
- }
- }
- fclose(S);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement