Hello all!
I have used this forum many times in the past to solve a variety of programming related problems, but am truly stumped on a segfault within a binary search tree. I have isolated the segfault to a fscanf statement that look legitamate to me. The following code blocks are the function that contains the fscanf statement:
int fscan_unit(FILE *filep, object_t *object){
int status;
/************************** SEGFAULT **************************/
status = fscanf(filep, "%d%d%d%s", &object->id,
&object->section,
&object->credits,
object->course );
/************************** SEGFAULT **************************/
if(status == 4){
status = 1;
}
else if(status != EOF){
status = 0;
}
return status;
}
and the structure template that is being writen to.
typedef struct object_s{
int id,
section,
credits;
char course[7];
}object_t;
Let me know if you need to see any more of the code (I think these two bits are the important parts).
Thanks in advance for any help on this one!
-vikingsheepman