Hey all this is my first post! Recently just finished a program but I am getting a segmentation fault when I try to call a switch statement with a private variable from the header file as the switch.
Here is the function with the switch statement in *.cpp:
1 2 3 4 5 6 7 8 9 10 11 12
int inode::get_type(){
int type_int = 2;
switch(type){ //gdb backtraced to here
case DIR_INODE:
type_int = 0;
break;
case FILE_INODE:
type_int = 1;
break;
}
return type_int;
}
and here is where the variable "type" is located:
1 2 3 4 5 6 7 8 9 10 11 12
class inode {
private:
int inode_nr;
inode_t type;
union {
directory *dirents;
wordvec *data;
} contents;
staticint next_inode_nr;
public:
//more prototypes
}
Any help is greatly appreciated! also, if it matters, main is in a completely diff *.cpp file.