diff --git a/data/students.test.txt b/data/students.test.txt index f282c1a..210c480 100644 --- a/data/students.test.txt +++ b/data/students.test.txt @@ -26,4 +26,9 @@ SS3 3 5 3 +2 +SS +SS +SS +1 2 \ No newline at end of file diff --git a/work1/single.c b/work1/single.c index fb3138a..1f778b4 100644 --- a/work1/single.c +++ b/work1/single.c @@ -1,5 +1,6 @@ #include "stdio.h" #include "stdlib.h" +#include "string.h" #define BUFFER_SIZE 128 #define MAX_NO_OF_UNITS 4 @@ -157,11 +158,11 @@ void add_student(char student_name[20], char student_id[10], char course_name[20 STUDENT *temp, *iterator; temp = (struct student_tag *)malloc(sizeof(struct student_tag)); PERSON info; - strncpy(info.name, student_name, 20); - strncpy(info.id, student_id, 10); + memcpy(info.name, student_name, 20); + memcpy(info.id, student_id, 10); COURSE course; - strncpy(course.course_name, course_name, 20); + memcpy(course.course_name, course_name, 20); course.no_of_units = no_of_units; // memcpy(course.marks, marks);