I haven't looked too deeply into your code but at first glance there are a few things that are dangerous/undefined and wrong with your code. For a start: pointers in C++ (and C for that matter) are [B]not[/B] automatically set to NULL (0) when they are declared. They have an undefined value (which might be NULL but is not neccessarily NULL). You should always explicitly set them to NULL at creation.
For a free standing variable you do this by
[CODE]int pInt = 0;[/CODE]
A member variable you set to 0 in the initialisation list of the constructors of your struct/class
struct Xyz
Xyx() : pDbl(NULL)
Speaking of constructors: You should always provide the following 4 members of a class/struct that has a pointer variable:
1) Default constructor
2) Copy constructor
3) Assignment operator
4) destructor
If you do not, they are silently provided to you and unfortunately they will most likely not do what you would like them to do.
Once you sorted those things out, you are a huge step closer to make your program work.
Hope that helps.