Ejemplo n.º 1
0
//gets the course number form user
long getCourseFromUser(FILE *fptr) {
    
    //refer to displayOneCourse(FILE *fptr) for documentation
    printf("Please enter the course number in the format ddd.nnn: ");
    int dept, num;
    scanf("%d.%d", &dept, &num);
    
    //checks department number is in range
    if (dept<1 || dept >700) {
        fprintf(stderr, "Input error, transaction failed\n");
        return -1;
    }
    
    //checks the course number is in range
    if (num<100||num>899) {
        fprintf(stderr, "Input error, transaction failed\n");
        return -1;
    }
    
    //looks for the struct
    fseek(fptr, findLocation(dept, num), SEEK_SET);
    Course m;
    fread(&m, sizeof(Course), 1, fptr);
    
    //if the struct contains 000.000
    if (m.dept == 0 || m.num == 0) {
        fprintf(stderr, "Course does not exist, transaction failed\n");
        return -1;
    }
    
    return findLocation(dept, num);
    
}
Ejemplo n.º 2
0
String TypeProfiler::typeInformationForExpressionAtOffset(TypeProfilerSearchDescriptor descriptor, unsigned offset, intptr_t sourceID, VM& vm)
{
    // This returns a JSON string representing an Object with the following properties:
    //     globalTypeSet: 'JSON<TypeSet> | null'
    //     instructionTypeSet: 'JSON<TypeSet>'

    TypeLocation* location = findLocation(offset, sourceID, descriptor, vm);
    ASSERT(location);

    StringBuilder json;  

    json.append("{");

    json.append("\"globalTypeSet\":");
    if (location->m_globalTypeSet && location->m_globalVariableID != TypeProfilerNoGlobalIDExists)
        json.append(location->m_globalTypeSet->toJSONString());
    else
        json.append("null");
    json.append(",");

    json.append("\"instructionTypeSet\":");
    json.append(location->m_instructionTypeSet->toJSONString());
    json.append(",");

    json.append("\"isOverflown\":");
    if (location->m_instructionTypeSet->isOverflown() || (location->m_globalTypeSet && location->m_globalTypeSet->isOverflown()))
        json.append("true");
    else
        json.append("false");


    json.append("}");
    
    return json.toString();
}
Ejemplo n.º 3
0
//read a text file containing course data, put into database
int readTextData(FILE *fptr) {
    printf("Enter the filename: ");
    
    char buffer[100];
    scanf("%s", buffer);
    
    //opens the text file
    FILE* txtptr;
    txtptr = fopen(buffer, "r");
    
    if (txtptr == NULL) {
        fprintf(stderr,"Input file could not be opened.\n");
        return 0;
    }
    
    unsigned int c1, c2;
    char div[3];
    unsigned int dept, num;
    int count = 0;
    int c = ' ';
    char title[LENGTH+1];
    int lineNum=1; //line number of the text file
    
    //adapted from provided code
    while(fscanf(txtptr, "%2s.%u.%u %u.%u ", div, &dept, &num, &c1, &c2) !=EOF) {
        while (count < LENGTH && (c = fgetc(txtptr)) != '\n') {
            title[count++] = (char) c;
        }
        title[count] = '\0';
        while (c != '\n') {
            c = fgetc(txtptr);
        }
        count=0;
        if (checkCourseError(c1, c2, div, dept, num, title)) {
            fprintf(stderr, "Error when reading in course text file (line %d)\n", lineNum);
        } else {
            
            Course *n = malloc(sizeof(Course));
            memset(n, 0, sizeof(Course)); //initializes struct to 0
            
            n->c1 = c1;
            n->c2 = c2;
            n->dept = dept;
            n->num = num;
            strcpy(n->div, div);
            strcpy(n->title, title);
            
            //fptr goes to appropriate location then writes struct to file
            fseek(fptr, findLocation(dept, num), SEEK_SET);
            fwrite(n, sizeof(Course), 1, fptr);
            
            free(n);

        }
        lineNum++;
    }
    fclose(txtptr);
    printf("Transaction completed.\n");
    return 1;
}
Ejemplo n.º 4
0
//displays all courses to screen
int displayAll(FILE *fptr) {
    unsigned int dept, num;
    
    printf("Printing all courses in the database to the screen:\n");
    
    //while course number is in range
    for (dept=1; dept<=700; dept++) {
        for (num = 100; num<=899; num++) {
            
            //reads the course
            fseek(fptr, findLocation(dept, num), SEEK_SET);
            Course m;
            fread(&m, sizeof(Course), 1, fptr);
            
            //if the struct does not contain 000.000
            if (!(m.dept == 0 || m.num == 0)) {
                  printf("%2s.%03u.%03u %u.%u %s\n", m.div, m.dept, m.num, m.c1, m.c2, m.title);
            }
            
        }
    }
    
    printf("All courses printed.\n");
    return 1;
}
Ejemplo n.º 5
0
void TaskPacker::findTaskDetails(int index) {
	findDateAndTime(index);
	findDoneStatus(index);
	findLocation(index);
	findName(index);

	return;
}
Ejemplo n.º 6
0
bool
ObjectCache::findLocation(Id location_id, Location& location)
{
    Location* object = findLocation(location_id);
    if (object == NULL) return false;
    location = *object;
    return true;
}
Ejemplo n.º 7
0
Resources::Location *ResourceProvider::getLocation(uint16 level, uint16 location) const {
	Current *current = findLocation(level, location);

	if (current) {
		return current->getLocation();
	}

	return nullptr;
}
Ejemplo n.º 8
0
void WalkMgr::loadState(Archive &archive) {
	_isWalking = archive.readByte();
	_current.name = archive.readString();
	if (!_current.name.empty()) {
		_current.coords = getLocationCoordinates(_current.name);
	}
	if (_isWalking) {
		_next.name = archive.readString();
		_destination = findLocation(archive.readString());
		_next.coords = getLocationCoordinates(_next.name);
	}
}
Ejemplo n.º 9
0
/*
 * update_blk - update block info, rehash if pointers are different,
 * update location info if needed
 */
static void update_blk(void* p, void* np, size_t size, const char* file, int line)
{
  BlkHdr* bh;
  if (p != np) {
    BlkHdr* bh_prev = 0;
    unsigned long h = hash_ptr(p);

    /* 
     * remove the old entry from the hash table 
     */
    for (bh = bhTab[h]; bh; bh = bh->next) {
      if (p == bh->buf) {
        if (0 == bh_prev)
          bhTab[h] = bh->next;
        else
          bh_prev->next = bh->next;
        /* 
         * put it back in the hash table at hash(np) 
         */
        h = hash_ptr(np);
        bh->next = bhTab[h];
        bhTab[h] = bh;
        break;
      }
      bh_prev = bh;
    }
  }
  else
    bh = find_blk(p);
  /*
   * invalid ptr? 
   */
  assert(0 != bh);
  byteCount -= bh->size;
  byteCount += size;
  bh->buf = np;
  bh->size = size;
  /* 
   * update location info 
   */
  if (bh->location->file != file || bh->location->line != line) {
    if (--bh->location->count == 0)
      freeLocation(bh->location);
    if ((bh->location = findLocation(file, line)) == 0) {
      if ((bh->location = addLocation(file, line)) == 0)
        noMemFn();
    }
    assert(0 != bh->location);
    ++bh->location->count;
  }
}
Ejemplo n.º 10
0
void WalkMgr::update() {
	if (_leadActor->isPlaying())
		return;

	WalkShortestPath path(this);
	_current = _next;
	WalkLocation *next = path.next(findLocation(_current.name), _destination);
	if (next) {
		initNextWayPoint(next);
		_leadActor->setAction(getWalkAction());
	} else
		end();

}
Ejemplo n.º 11
0
void TypeProfiler::logTypesForTypeLocation(TypeLocation* location, VM& vm)
{
    TypeProfilerSearchDescriptor descriptor = location->m_globalVariableID == TypeProfilerReturnStatement ? TypeProfilerSearchDescriptorFunctionReturn : TypeProfilerSearchDescriptorNormal;

    dataLogF("[Start, End]::[%u, %u]\n", location->m_divotStart, location->m_divotEnd);

    if (findLocation(location->m_divotStart, location->m_sourceID, descriptor, vm))
        dataLog("\t\t[Entry IS in System]\n");
    else
        dataLog("\t\t[Entry IS NOT in system]\n");

    dataLog("\t\t", location->m_globalVariableID == TypeProfilerReturnStatement ? "[Return Statement]" : "[Normal Statement]", "\n");

    dataLog("\t\t#Local#\n\t\t", location->m_instructionTypeSet->dumpTypes().replace("\n", "\n\t\t"), "\n");
    if (location->m_globalTypeSet)
        dataLog("\t\t#Global#\n\t\t", location->m_globalTypeSet->dumpTypes().replace("\n", "\n\t\t"), "\n");
}
Ejemplo n.º 12
0
//reads one course from stdin, puts into database
int readOneCourse(FILE *fptr) {
    
    printf("Enter the course in the format EN.ddd.nnn c.f title: ");
    
    //adapted from provided code
    unsigned int c1, c2;
    char div[3];
    unsigned int dept, num;
    int count = 0;
    int c = ' ';
    char title[LENGTH+1];

    scanf("%2s.%u.%u %u.%u ", div, &dept, &num, &c1, &c2);
    while (count < LENGTH && (c = getchar()) != '\n') {
        title[count++] = (char) c;
    }
    title[count] = '\0';
    
    if (checkCourseError(c1, c2, div, dept, num, title)) {
        fprintf(stderr, "Input error, transaction failed\n");
        return 0;
    } else {
        Course *n = malloc(sizeof(Course));
        memset(n, 0, sizeof(Course)); //initializes struct to 0
        
        n->c1 = c1;
        n->c2 = c2;
        n->dept = dept;
        n->num = num;
        strcpy(n->div, div);
        strcpy(n->title, title);
        
        //fptr goes to appropriate location then writes struct to file
        fseek(fptr, findLocation(dept, num), SEEK_SET);
        fwrite(n, sizeof(Course), 1, fptr);
        
        free(n);
        
        printf("Transaction completed.\n");
        return 1;
    }

}
Ejemplo n.º 13
0
void WalkMgr::start(WalkLocation *destination) {
	if (_current.name.empty()) {
		_current.name = _locations[0]->getName();
		_current.coords = getLocationCoordinates(_locations[0]->getName());
	}

	_destination = destination;

	if (_isWalking)
		return;

	if (_current.name == _destination->getName()) {
		end();
	} else {
		_isWalking = true;
		WalkLocation *currentLocation = findLocation(_current.name);
		WalkShortestPath path(this);
		WalkLocation *nextLocation = path.next(currentLocation, _destination);
		initNextWayPoint(nextLocation);
		_leadActor->setAction(getWalkAction());
	}
}
Ejemplo n.º 14
0
int EdgeWidget::location() const
{
	return findLocation(pos());
}
Ejemplo n.º 15
0
/*
 * fda_malloc - allocate size chunk of memory and create debug
 * records for it.
 */
void* fda_malloc(size_t size, const char* file, int line)
{
  void* p;
  size_t blk_size;
  Location* location;

  assert(0 < size);
  assert(0 != file);
  assert(sizeof(void*) == sizeof(size_t));

  /*
   * memory limiter do not allocate more than byteLimit
   */
  if ((size + byteCount) > byteLimit)
    return 0;

  /* 
   * Make sure that there is enough room for prefix/postfix 
   * and we get an aligned buffer 
   */
  blk_size = BASE_SIZE(size);

  if ((p = malloc(blk_size)) == 0) {
    lowMemFn();
    if ((p = malloc(blk_size)) == 0)
      noMemFn();
  }
  /* 
   * don't allow malloc to fail 
   */
  assert(0 != p);
  /* 
   * shred the memory and set bounds markers 
   */
  SHRED_MEM(p, blk_size);
  *((size_t*) p) = DEADBEEF;
  *((size_t*) (BYTE_PTR(p) + blk_size - S_SIZE)) = DEADBEEF;

  /* 
   * find the location or create a new one 
   */
  if (0 == (location = findLocation(file, line))) {
    if (0 == (location = addLocation(file, line))) {
      free(p);
      noMemFn();
    }
  }
  /* 
   * don't allow noMemFn to return 
   */
  assert(0 != location);
  if (!make_blk(BYTE_PTR(p) + S_SIZE, size, location)) {
    if (0 == location->count)
      freeLocation(location);
    free(p);
    p = 0;
    noMemFn();
  }
  /* 
   * don't allow noMemFn to return 
   */
  assert(0 != p);
  return (BYTE_PTR(p) + S_SIZE);
}
Ejemplo n.º 16
0
DataObject*
ObjectCache::find(Id object_id, bool cacheOnly)
{
    if (object_id == INVALID_ID)
	return NULL;

    if (_objects.find(object_id) != _objects.end())
	return _objects[object_id];

    if (cacheOnly)
	return NULL;

    DataObject object;
    if (!_db->lookup(object_id, object))
	return NULL;

    switch (object.dataType()) {
    case DataObject::ACCOUNT:		return findAccount(object_id);
    case DataObject::ADJUST_REASON:	return findAdjustReason(object_id);
    case DataObject::CARD_ADJUST:	return findCardAdjust(object_id);
    case DataObject::CHARGE:		return findCharge(object_id);
    case DataObject::CHEQUE:		return findCheque(object_id);
    case DataObject::CLAIM:		return findReceive(object_id);
    case DataObject::COMPANY:		return findCompany(object_id);
    case DataObject::COUNT:		return findCount(object_id);
    case DataObject::CUSTOMER:		return findCustomer(object_id);
    case DataObject::CUST_TYPE:		return findCustomerType(object_id);
    case DataObject::DEPT:		return findDept(object_id);
    case DataObject::DISCOUNT:		return findDiscount(object_id);
    case DataObject::EMPLOYEE:		return findEmployee(object_id);
    case DataObject::EXPENSE:		return findExpense(object_id);
    case DataObject::EXTRA:		return findExtra(object_id);
    case DataObject::GENERAL:		return findGeneral(object_id);
    case DataObject::GROUP:		return findGroup(object_id);
    case DataObject::INVOICE:		return findInvoice(object_id);
    case DataObject::ITEM:		return findItem(object_id);
    case DataObject::ITEM_ADJUST:	return findItemAdjust(object_id);
    case DataObject::ITEM_PRICE:	return findItemPrice(object_id);
    case DataObject::LABEL_BATCH:	return findLabelBatch(object_id);
    case DataObject::LOCATION:		return findLocation(object_id);
    case DataObject::NOSALE:		return findNosale(object_id);
    case DataObject::ORDER:		return findOrder(object_id);
    case DataObject::PO_TEMPLATE:	return findOrderTemplate(object_id);
    case DataObject::PAT_GROUP:		return findPatGroup(object_id);
    case DataObject::PAT_WS:		return findPatWorksheet(object_id);
    case DataObject::PAYOUT:		return findPayout(object_id);
    case DataObject::PERSONAL:		return findPersonal(object_id);
    case DataObject::PLU:		assert("Invalid data type: PLU");
    case DataObject::PRICE_BATCH:	return findPriceBatch(object_id);
    case DataObject::PROMO_BATCH:	return findPromoBatch(object_id);
    case DataObject::QUOTE:		return findQuote(object_id);
    case DataObject::RECEIPT:		return findReceipt(object_id);
    case DataObject::RECEIVE:		return findReceive(object_id);
    case DataObject::RECONCILE:		return findReconcile(object_id);
    case DataObject::RECURRING:		return findRecurring(object_id);
    case DataObject::REPORT:		assert("Invalid data type: REPORT");
    case DataObject::RETURN:		return findInvoice(object_id);
    case DataObject::SECURITY_TYPE:	return findSecurityType(object_id);
    case DataObject::SHIFT:		return findShift(object_id);
    case DataObject::SLIP:		return findSlip(object_id);
    case DataObject::STATION:		return findStation(object_id);
    case DataObject::STORE:		return findStore(object_id);
    case DataObject::SUBDEPT:		return findSubdept(object_id);
    case DataObject::TAX:		return findTax(object_id);
    case DataObject::TENDER:		return findTender(object_id);
    case DataObject::TEND_COUNT:	return findTenderCount(object_id);
    case DataObject::TEND_ADJUST:	return findTenderAdjust(object_id);
    case DataObject::TERM:		return findTerm(object_id);
    case DataObject::TODO:		return findTodo(object_id);
    case DataObject::USER:		return findUser(object_id);
    case DataObject::VENDOR:		return findVendor(object_id);
    case DataObject::WITHDRAW:		return findWithdraw(object_id);
    }

    qWarning("Unknown object type: " + object.dataTypeName());
    return NULL;
}
Ejemplo n.º 17
0
int main(int argc, char** argv) {
    
    /*File Pointers*/
        FILE *namef;
        FILE *entrantf;
        FILE *nodef;
        FILE *trackf;
        FILE *timef;
        FILE *coursef;
        FILE *logf;
    
    /*Filenames*/
    char namefile[30];
    char nodesfile[30];
    char tracksfile[30];
    char entrantsfile[30];
    char coursesfile[30];
    char cp_timesfile1[30];
    char logfile[30];
    
    /*These are the structures that will contain all the data read in*/
    NAME title[3];
    COURSE courses[26];
    ENTRANT *entrant_head = NULL;
    NODE *node_head = NULL;
    TRACK *track_head = NULL;
    TIME *time_head = NULL;

    char my_buffer[100];
    
    /*These variables are used when reading in files and calculating queries*/
    char name[100];
    int i, j, n1, n2, n3, h, m, timesanswer, answer, qh, qm, node;
    char t;

    i = 0;
    answer = 0;
    timesanswer = 0;
    
    
    /*This is where the user is asked to enter all the files that are needed to run the program They are entered sequentially
          to ensure that all files are read in and that none conflict with each other.*/
    
    printf("Please enter the name of the log file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", logfile);
    
    logf = fopen(logfile, "a");
    
    fprintf(logf, "Log File Opened\n");

    printf("Please enter the names file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", namefile);

    namef = fopen(namefile, "r");

    while (fgets(my_buffer, 80, namef) != NULL) {
        strcpy(title[i].line, my_buffer);
        i++;
    }

    fclose(namef);

    
    printf("Please enter the nodes file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", nodesfile);

    createLinkedNodes(&node_head, nodef, nodesfile);
     




    printf("Please enter the tracks file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", tracksfile);

    createLinkedTracks(&track_head, trackf, tracksfile);




    printf("Please enter the entrants file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", entrantsfile);

    createLinkedEntrants(&entrant_head, entrantf, entrantsfile);





    printf("Please enter the courses file: \n");
    scanf(" %[a-z,A-Z,.,_,0-9]", coursesfile);

    coursef = fopen(coursesfile, "r");


    while (!feof(coursef)) {
        i = 0;
        if (fscanf(coursef, "%c %d", &(courses[i].name),
                &(courses[i].amount)) == 2) {

            for (j = 0; j < courses[i].amount; j++) {
                while (fscanf(coursef, " %d", &(courses[i].nodes[j])) == 1);

            }
            fscanf(coursef, "\n");

            i++;
        } else {
            fprintf(stderr, "Error: file format wrong.\n");
            break;
        }
    }

    /*This prompts the user to choose how they will enter the first competitor's time. There is an
        option to add more later.*/

    printf(" Choose how times for competitors are entered.\n");
    printf(" 1. Enter a pre-prepared file of all competitors' times.\n");
    printf(" 2. Manually enter more times for competitors.\n");

    scanf("%d", &timesanswer);

    if (timesanswer == 1) {

        printf("Please enter the times file: \n");
        scanf(" %[a-z,A-Z,.,_,0-9]", cp_timesfile1);


        timef = fopen(cp_timesfile1, "r");

        while (fgets(my_buffer, 100, timef) != NULL) {
            sscanf(my_buffer, "%c %d %d %d:%d", &t, &n1, &n2, &h, &m);
            createLinkedTimes(&time_head, t, n1, n2, h, m);
        }

        fclose(timef);

    } else if (timesanswer == 2) {
        printf("How many times do you wish to enter? ");
        scanf(" %d", &i);
        int count = 0;
        while (count != i) {
            printf("Please enter the type of checkpoint :");
            scanf(" %[A-Z]", &t);
            printf("Please  enter the checkpoint node :");
            scanf(" %d", &n2);
            printf("Please enter the competitor number :");
            scanf(" %d", &n3);
            printf("Please enter the hours :");
            scanf(" %d", &h);
            printf("Please enter the minutes :");
            scanf(" %d", &m);

            createLinkedTimes(&time_head, t, n2, n3, h, m);

            count += 1;
        }
        printTimes(&time_head);
    }

    while (answer != 11) {

        for (i = 0; i < 3; i++) {
            printf("%s", title[i].line);
        }
        /*This prints out the last time entered into the linked list of times. This is assumed to be the current time.*/
        printf("Current Time : %02d:%02d\n", h, m);
        
        /*MENU*/
        printf("Please choose an option :\n");
        printf("1. Query the status and location of a competitor.\n");
        printf("2. Query how many competitors have not yet started.\n");
        printf("3. Query how many competitors are out on the course.\n");
        printf("4. Query how many competitors are finished.\n");
        printf("5. Add more times\n");
        printf("6. Results\n");
        printf("7. Query which competitors were excluded for going to an incorrect checkpoint\n");
        printf("8. Query which competitors were excluded for medical reasons\n");
        printf("9. Query when a competitor entered a medical checkpoint\n");
        printf("10. Query when a competitor left a medical checkpoint\n");
        printf("11. Quit\n");

        scanf("%d", &answer);
        
        /*Allows the user to query the location and status of one competitor*/
        if (answer == 1) {
            
            fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried location and status of a competitor\n", h, m, title[1].line);
            
            printf("Enter a time you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            if (compareTime(h, m, qh, qm) == 0) {
                printf("Time entered is after current time, please enter an appropriate time\n");
            } else {
                printf("Enter competitor's  number: \n");
                scanf("%d", &n1);

                findCompetitor(&entrant_head, n1, name);
                if ((strcmp(name, "Not Found")) != 0) {
                    printf("Name : %s\n", name);

                    node = 0;

                    node = findLocation(&time_head, n1, qh, qm);
                    if (node == 100) {
                        printf("Location : %d\n", node);
                        printf("Status : Finished\n");
                        printf("\n");
                    }
                    if (node == 0) {
                        printf("Status : Not Started\n");
                        printf("\n");
                    } else {
                        printf("Location : %d\n", node);
                        printf("Status : On Course\n");
                        printf("\n");
                    }

                }
                else {
                    printf("%s\n", name);
                }


            }
            
            /*Allows the user to query all the competitors that have not started*/
        } else if (answer == 2) {
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried which competitors had not started\n", h, m, title[1].line);

            printf("Enter a time for you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            queryNotStarted(&time_head, &entrant_head, qh, qm);

              /*Allows the user to query all the competitors that are out on course*/
        } else if (answer == 3) {
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried which competitors are out on course\n", h, m, title[1].line);
            
            printf("Enter a time for you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            queryOnCourse(&time_head, &entrant_head, qh, qm);
            
            
             /*Allows the user to query all the competitors that are finished*/
        }else if (answer == 4) {
            
            fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried which competitors are finished\n", h, m, title[1].line);
            
            printf("Enter a time for you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            queryFinished(&time_head, &entrant_head, qh, qm);
            
            
            /*Allows the user to enter more times*/
        } else if (answer == 5) {
            
            printf(" Choose how times for competitors are entered.\n");
            printf(" 1. Enter a pre-prepared file of all competitors' times.\n");
            printf(" 2. Manually enter more times for competitors.\n");

            scanf("%d", &timesanswer);

            if (timesanswer == 1) {
                
                 fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Added more times from a file\n", h, m, title[1].line);

                printf("Please enter the times file: \n");
                scanf(" %[a-z,A-Z,.,_,0-9]", cp_timesfile1);


                timef = fopen(cp_timesfile1, "r");

                while (fgets(my_buffer, 100, timef) != NULL) {
                    sscanf(my_buffer, "%c %d %d %d:%d", &t, &n1, &n2, &h, &m);
                    createLinkedTimes(&time_head, t, n1, n2, h, m);
                }

                fclose(timef);

                printTimes(&time_head);

            } else if (timesanswer == 2) {
                
                 fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Manually entered more times\n", h, m, title[1].line);
                
                printf("How many times do you wish to enter? ");
                scanf(" %d", &i);
                int count = 0;
                while (count != i) {
                    printf("Please enter the type of checkpoint :");
                    scanf(" %[A-Z]", &t);
                    printf("Please  enter the checkpoint node :");
                    scanf(" %d", &n2);
                    printf("Please enter the competitor number :");
                    scanf(" %d", &n3);
                    printf("Please enter the hours :");
                    scanf(" %d", &h);
                    printf("Please enter the minutes :");
                    scanf(" %d", &m);

                    createLinkedTimes(&time_head, t, n2, n3, h, m);

                    count += 1;
                }
                printTimes(&time_head);
            }
        }
        /*Allows the user to print out the results*/
        else if (answer == 6) {
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Checked results\n", h, m, title[1].line);
            
            queryResults(&time_head, &entrant_head, h, m);
        }
        
        
        
        else if(answer == 7){
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried which competitors were excluded for incorrect checkpoints \n", h, m, title[1].line);
            
              printf("Enter a time for you wish to query for : \n");
              scanf("%d:%d", &qh, &qm);

            queryWrongExclusion(&time_head, &entrant_head, qh, qm);
        }
        
        
        
        else if(answer == 8){
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried which competitors were excluded for medical reasons \n", h, m, title[1].line);
            
              printf("Enter a time for you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            queryMedicalExclusion(&time_head, &entrant_head, qh, qm);
        }

        else if (answer == 9) {
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried a competitor's entry into a medical checkpoint \n", h, m, title[1].line);
            
            int compNum = 0;
            
            
            printf("Enter a time you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            if (compareTime(h, m, qh, qm) == 0) {
                printf("Time entered is after current time, please enter an appropriate time\n");
            } else {
                printf("Enter competitor's  number: \n");
                scanf("%d", &compNum);

                findCompetitor(&entrant_head, compNum, name);
                if ((strcmp(name, "Not Found")) != 0) {
                    printf("Name : %s\n", name);

                    char type;
                    
                    type = findType(&time_head, compNum, qh, qm);
                    
                    if(type == 'A'){
                        int h = findHourTime(&time_head, compNum, qh, qm);
                        int m = findMinutesTime(&time_head, compNum, qh, qm);
                        printf("Time : %d:%d", h, m);
                    }

                }
                else {
                    printf("%s\n", name);
                }
        }
        
        }
        
        else if(answer == 10){
            
             fprintf(logf, "Time :  %02d:%02d  Date : %s Activity : Queried a competitor's departure from a medical checkpoint \n", h, m, title[1].line);
            
            int compNum = 0;
            
            printf("Enter a time you wish to query for : \n");
            scanf("%d:%d", &qh, &qm);

            if (compareTime(h, m, qh, qm) == 0) {
                printf("Time entered is after current time, please enter an appropriate time\n");
            } else {
                printf("Enter competitor's  number: \n");
                scanf("%d", &compNum);

                findCompetitor(&entrant_head, compNum, name);
                if ((strcmp(name, "Not Found")) != 0) {
                    printf("Name : %s\n", name);

                    char type;
                    
                    type = findType(&time_head, compNum, qh, qm);
                    
                    if(type == 'D'){
                        int h = findHourTime(&time_head, compNum, qh, qm);
                        int m = findMinutesTime(&time_head, compNum, qh, qm);
                        printf("Time : %d:%d \n", h, m);
                    }

                }
                else {
                    printf("%s\n", name);
                }
            
        }
        
    }        
        
        }


    return (EXIT_SUCCESS);

}