Skip to content
Snippets Groups Projects
Commit 176e5cb0 authored by Wendy Nguyen's avatar Wendy Nguyen
Browse files

update

parent 10cb457f
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ int get_student(int fd, int id, student_t *s){
ssize_t bytesRead;
// find record in position in db using student id
offset = (id - 1) * STUDENT_RECORD_SIZE;
offset = (id) * STUDENT_RECORD_SIZE;
if (lseek(fd, offset, SEEK_SET) == -1) {
return ERR_DB_FILE; // database file I/O issue
......@@ -111,7 +111,7 @@ int add_student(int fd, int id, char *fname, char *lname, int gpa){
off_t offset;
ssize_t bytesWrite;
offset = (id - 1) * STUDENT_RECORD_SIZE;
offset = (id) * STUDENT_RECORD_SIZE;
static student_t temp;
int duplicate = get_student(fd, id, &temp);
......@@ -183,7 +183,7 @@ int del_student(int fd, int id){
ssize_t bytesWrite;
static student_t s;
offset = (id - 1) * STUDENT_RECORD_SIZE;
offset = (id) * STUDENT_RECORD_SIZE;
if (lseek(fd, offset, SEEK_SET) == -1) {
printf(M_ERR_DB_READ);
......@@ -384,7 +384,7 @@ void print_student(student_t *s){
return;
}
float coverted_gpa = s->gpa / 100.0;
float converted_gpa = s->gpa / 100.0;
printf(STUDENT_PRINT_HDR_STRING, "ID", "FIRST NAME", "LAST NAME", "GPA");
printf(STUDENT_PRINT_FMT_STRING, s->id, s->fname, s->lname, converted_gpa);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment