/* * reads in data from all relevant files * returns a pointer to an event object */ Event* read_data() { char* filename; Event* event; Vector* nodes; Vector* tracks; Vector* courses; Vector* entrants; filename = get_filename("Please enter name file: "); event = read_event(filename); filename = get_filename("Please enter nodes file: "); nodes = read_nodes(filename); filename = get_filename("Please enter tracks file: "); tracks = read_tracks(filename, nodes); filename = get_filename("Please enter courses file: "); courses = read_courses(filename, nodes, tracks); filename = get_filename("Please enter entrants file: "); entrants = read_entrants(filename, courses); event->nodes = nodes; event->entrants = entrants; return event; }
/** * @brief This function prompts the user with a question asking for the path to * a file containing data on entrants. The Data should include a positive * integer that represents a id. A single capital character which is the id of * the course the entrant has signed up for. Followed by a no longer than 80 * characters long name. * * @return The function returns a pointer to a ENTRANT array if the function * was successful. If it fails the function returns NULL. */ ENTRANT_LIST *get_entrants() { char response[255]; do { ENTRANT_LIST *temp = NULL; printf("Please enter a path to a file containing entrant data:"); scanf(" %[^\t\n]", response); temp = read_entrants(response); if (temp != NULL) { printf("[i] %d entrants loaded from '%s'.\n\n", temp->size, response); return temp; } } while (1); }