Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access to objects created with new

Status
Not open for further replies.

reneb

Programmer
Aug 8, 2000
43
US
I am trying to implement a linked list of objects of type SiteStructure:
struct SiteStructure
{
int numOfSect;
double easting;
double northing;
CString siteCodeStr;
CString prdPath[6];
CString prdNames[6];
double eIRP[6];
int angle[6];
SiteStructure * nextSite;
}

I use a function to create the linked list using the "new" command:
struct SiteStructure* pSStruct = new SiteStructure;

to create each element in the list, but when my function returns and the calling method tries to access the data in the linked list elements I get memory access error. It seems like the elements of the linked list have scope limited to the function that created them. Any suggestions on how to fix the problem, any idea. Thanks, your help is greatly appreciated. [sig][/sig]
 
Never mind. I found the source of my error. thanks. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top