File Processing - Sequential and Direct Access/lab7b.c
void readEmpList(Employee *EmpList, const char *FileName){
    FILE *filePtr;

    if((filePtr = fopen(FileName, "r")) == NULL) puts("FILE COULD NOT BE OPENED");
    else{
        int count = 0;
        Employee emp = {0};
        fscanf(filePtr, "%d%s%s%f\n", &(emp.id), emp.firstname, emp.lastname, &(emp.GPA));
        wordCap(emp.firstname);
        wordCap(emp.lastname);
        EmpList[count] = emp;

        while(!feof(filePtr)){  
            count++;
            Employee emp = {0};
            fscanf(filePtr, "%d %s %s %f\n", &(emp.id), emp.firstname, emp.lastname, &(emp.GPA));
            wordCap(emp.firstname);
            wordCap(emp.lastname);
            EmpList[count] = emp;
        }
        fclose(filePtr);
    }
}
/*  
    readEmpList: Read employee records from a file into an array of stucts 
    input: the array to save to, the file to read from
*/
Read employee records from a file into an array of stucts
input: the array to save to, the file to read from
Read employee records from a file into an array of stucts input : the array to save to the file to read from
void readEmpList(Employee *EmpList, const char *FileName){
    FILE *filePtr;
    if((filePtr = fopen(FileName, "r")) == NULL) puts("FILE COULD NOT BE OPENED");
    else{
        int count = 0;
        Employee emp = {0};
        fscanf(filePtr, "%d%s%s%f\n", &(emp.id), emp.firstname, emp.lastname, &(emp.GPA));
        wordCap(emp.firstname);
        wordCap(emp.lastname);
        EmpList[count] = emp;
        while(!feof(filePtr)){  
            count++;
            Employee emp = {0};
            fscanf(filePtr, "%d %s %s %f\n", &(emp.id), emp.firstname, emp.lastname, &(emp.GPA));
            wordCap(emp.firstname);
            wordCap(emp.lastname);
            EmpList[count] = emp;
        }
        fclose(filePtr);
    }
}
void readEmpList ( Employee * EmpList , const char * FileName ) { FILE * filePtr ; if ( ( filePtr = fopen ( FileName , " " ) ) == NULL ) puts ( " " ) ; else { int count = 0 ; Employee emp = { 0 } ; fscanf ( filePtr , " \n " , & ( emp . id ) , emp . firstname , emp . lastname , & ( emp . GPA ) ) ; wordCap ( emp . firstname ) ; wordCap ( emp . lastname ) ; EmpList [ count ] = emp ; while ( ! feof ( filePtr ) ) { count ++ ; Employee emp = { 0 } ; fscanf ( filePtr , " \n " , & ( emp . id ) , emp . firstname , emp . lastname , & ( emp . GPA ) ) ; wordCap ( emp . firstname ) ; wordCap ( emp . lastname ) ; EmpList [ count ] = emp ; } fclose ( filePtr ) ; } }
readEmpList: Read employee records from a file into an array of stucts
input: the array to save to, the file to read from
readEmpList : Read employee records from a file into an array of stucts input : the array to save to the file to read from