Hi everyone,
I'm having a bit of a nightmare with some code I'm trying to write in C++.
Basically, I have a structure like this:
which is contained within a variable 'void* userdef', which is part of a structure for another object. So basically I have a structure within a structure.
The problem I keep getting, is that if I assign a value to 'genObs' (i.e. assigning a string), my program keeps crashing! So far I have this:
In case you are wondering, the 'mav_malloc' is a specific function for the toolkit I'm using (its for creating 3D virtual environments).
I don't understand why I keep getting a crash whenever I assign a string! If I try to assign an int to the 'priority' field, I have no problems!
Any help would be appreciated!
TIA.
I'm having a bit of a nightmare with some code I'm trying to write in C++.
Basically, I have a structure like this:
Code:
typedef struct{
char *name;
string genObs;
char *details;
char *propAct;
int priority;
}modelInfo;
which is contained within a variable 'void* userdef', which is part of a structure for another object. So basically I have a structure within a structure.
The problem I keep getting, is that if I assign a value to 'genObs' (i.e. assigning a string), my program keeps crashing! So far I have this:
Code:
modelInfo *mi = (modelInfo *) mav_malloc(sizeof(modelInfo));
string s = "test string";
mi->genObs = s;
In case you are wondering, the 'mav_malloc' is a specific function for the toolkit I'm using (its for creating 3D virtual environments).
I don't understand why I keep getting a crash whenever I assign a string! If I try to assign an int to the 'priority' field, I have no problems!
Any help would be appreciated!
TIA.