I get this error when trying to run round robin algorithm, and the algorithms are working perfectly fine when taking input from user. this is the code:
else if (select==2)
{
FILE * filehandle;
char lyne[100];
char *item;
int reccount = 0;
// open file
filehandle = fopen("Input_Data1.txt","r");
// Read file line by line
while (fgets(lyne,99,filehandle))
{
numprocess =
printf("%s",lyne);
item = strtok(lyne," ");
p[reccount].arrivetime =atoi(item);
item = strtok(NULL," ");
p[reccount].bursttime =atoi(item);
reccount++;
}
//Close file
fclose(filehandle);
}
The error I get is segmentation fault (core dumped).
I tried reading from a file execting the same result as reading from user input but I got the error showed in the image.