Change that to this:
copyOfpObj->extra_descr = str_dup(pObj->extra_descr);

Which will copy the string, but write it to a new space in memory and
assign copyOfpObj's pointer to that new space...

Richard Lindsey
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 27, 2004 12:01 PM
To: [email protected]
Subject: Object extra descriptions

I am using a snippet from Zanthras of Mystical Realities MUD for their
object
copy code. I am having one problem with it. When I copy the object the
extra
descriptions are both pointing the same address in memeory so it's
obivously
causing problems. So yeah, I'm really bad with pointers lol, and I know
this is
an easy way to fix it.

Here is the line in question:
copyOfpObj->extra_descr = pObj->extra_descr;

Thanks




-- 
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to