"JasBascom" <ja*******@aol. com> wrote in message
news:20******** *************** ****@mb-m11.aol.com
rec is the pointer to a union
it is declared thus union Allrecords* rec.
Now that you know what rec is does that help you to help me?
Yes. A pointer simply stores a memory address. Thus rec is meant to store
the address of an instance of Allrecords. However, you never create an
instance of Allrecords (as far as one can tell from the still-limited
information that you have provided), so rec never gets the chance to perform
its proper function. Instead, whatever value rec is storing points to memory
that you don't own and hence you get an access violation when you try to
write to it. You could create an instance of Allrecords with the following:
union Allrecords* rec = new Allrecords;
which allocates memory for an instance of Allrecords and makes rec point to
it. You could also forget about pointers and just declare:
union Allrecords rec_obj;
to create an Allrecords object called rec_obj.
Whether you are accessing the members of this structure correctly with
* rec->Newcrecord.rec ord_type = record_typec;
is again impossible to tell without seeing the definition of Allrecords.
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)