programm crashes wenn retrieving a CString
-
hi, i've developed a program that puts a struct into a linked list... Wenn i put the new record into my list, and i read it after that, the program crashes(wenn getting the CString)... the problem is that my list is not updated at all... if i read a number that is inserted with the value 3, it has the value -2421523832 wenn retreiving it... now i want to know how to update my list, not that i don't know it at all but my way is not working. i get the pointer(Leverancier) to my struct in the function that updates the list...
NewLeverancier = new CLeverancierStruct; NewLeverancier = Leverancier; m_LeveranciersLijst.AddTail(NewLeverancier);
should this work? []D [] []D [] -
hi, i've developed a program that puts a struct into a linked list... Wenn i put the new record into my list, and i read it after that, the program crashes(wenn getting the CString)... the problem is that my list is not updated at all... if i read a number that is inserted with the value 3, it has the value -2421523832 wenn retreiving it... now i want to know how to update my list, not that i don't know it at all but my way is not working. i get the pointer(Leverancier) to my struct in the function that updates the list...
NewLeverancier = new CLeverancierStruct; NewLeverancier = Leverancier; m_LeveranciersLijst.AddTail(NewLeverancier);
should this work? []D [] []D []Hi Willen, I asked this very question a couple of days ago. Didn't you undesrstand my reply? If so, I'll gladly try to make myself clearer, if you're so kind as to tell me what you didn't get. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
hi, i've developed a program that puts a struct into a linked list... Wenn i put the new record into my list, and i read it after that, the program crashes(wenn getting the CString)... the problem is that my list is not updated at all... if i read a number that is inserted with the value 3, it has the value -2421523832 wenn retreiving it... now i want to know how to update my list, not that i don't know it at all but my way is not working. i get the pointer(Leverancier) to my struct in the function that updates the list...
NewLeverancier = new CLeverancierStruct; NewLeverancier = Leverancier; m_LeveranciersLijst.AddTail(NewLeverancier);
should this work? []D [] []D []You need to give us some more information. From the code above it looks like you have a pointer which you set to a new struct instance. You then point it to a previous instance which you add to the list...? It may already be in! You mention strings and numbers without giving us actual facts / definitions. Try something like the following (if you like MFC):
struct Foo
{
int nBar;
};CTypedPtrList FooList;
Foo *f1 = new Foo;
Foo *f2 = new Foo;f1->nBar = 3;
f1->nBar = 17;FooList.AddTail (f1);
FooList.AddTail (f2);Foo *f = FooList.GetHead ();
TRACE1("nBar=%i\n", f->nBar);
f = FooList.GetHead ();
TRACE1("nBar=%i\n", f->nBar);...
There are STL equivalents to the above code, but I'm not so confident with STL to rattle out a chunk of code off the top of my head. Iain.
-
Hi Willen, I asked this very question a couple of days ago. Didn't you undesrstand my reply? If so, I'll gladly try to make myself clearer, if you're so kind as to tell me what you didn't get. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
well it didn't work... i made the the struct then i send the pointer to that struct towards the function to safe it in the list... than after that i just want to put it into the linked list... so: you say i have to do this:
NewLeverancier /* witch is the new pointer */ = new CLeverancierStruct(*Leverancier /* witch is the pointer to the struct */); m_LeveranciersLijst/* witch is the list */.AddTail(NewLeverancier);
[]D [] []D [] -
Hi Willen, I asked this very question a couple of days ago. Didn't you undesrstand my reply? If so, I'll gladly try to make myself clearer, if you're so kind as to tell me what you didn't get. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
Hi Willen, I asked this very question a couple of days ago. Didn't you undesrstand my reply? If so, I'll gladly try to make myself clearer, if you're so kind as to tell me what you didn't get. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo