Pic of the Error?
When i use AddItem[Located in sTab struct. I get an error about Char*Item_Name. It Compiles fine just when I call that one function everything got a problem.
[php]struct sItem
{
char* Name, **Options;
int* Value;
bool Selectable;
sItem(char* NAME, char** OPTIONS, int* VALUE, bool SELECTABLE)
{
Name=NAME;Options=OPTIONS;Value=VALUE;Selectable=S ELECTABLE;
}
~sItem()
{}
};
struct sTab
{
int noItems, totHeight;
char* Name;
sItem* Items;
int Selected;
void AddItem(char* Item_Name, char** Options, int* DefaultValue=0)
{
Items[noItems]=sItem(Item_Name, Options, DefaultValue, true);
noItems++;
totHeight=(noItems*15);
}
void AddText(char* Item_Name, char* Option)
{
Items[noItems]=sItem(Item_Name, (char**)Option, 0, false);
noItems++;
totHeight=(noItems*15);
}
sTab(){
Name="New Tab";
noItems=0;
totHeight=60;
Selected=0;
}
~sTab()
{
Items=new sItem((char*)NULL,(char**)NULL, (int*)NULL, (bool)NULL);
Name=(char*)NULL;
noItems=0;
totHeight=0;
}
};
[/php]
Last edited by topblast; 01-10-2011 at 11:26 PM.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
extactly, whats the error you get?
Image added
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
i only see you creating 1 itemCode:sItem* Items; Items=new sItem((char*)NULL,(char**)NULL, (int*)NULL, (bool)NULL); Items[noItems]=sItem(Item_Name, Options, DefaultValue, true);
be very careful with pointers!
very dangerous thing if you do it the wrong wayCode:char* Name, **Options; int* Value;
Last edited by Gordon`; 01-11-2011 at 12:55 AM.
[MPGH]AVGN (01-11-2011)
topblast (01-12-2011)
Honey its cuz when you add a new item. That item doesn't exist.
Right there babay
You either need to either initialize an array of sItemsCode:Items[noItems]=sItem(Item_Name, (char**)Option, 0, false);
orCode:Items = new sItems[some number];
make Items a sItems**, meaning it will only point to new sItems, and not hold the struct in the array honey.
I would do the first since if you do the latter its a good chance your structs will be deleted since they are declared in scope babe.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
btw that made more sense when I was a girl.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
now i am getting a similar problem with my drawtext Then when i dont drawText I get an error with Show() Function
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development