Re: char_player_data problem, again...

From: Peter Ajamian (pajamian@cheapsam.com)
Date: 09/23/99


Zeavon wrote:

> I could be wrong, but I bet you have something like:
> ch->titlea = "with a big nose"
> OR
> ch->titlea = argument;

Actually, these lines will not cause a seg fault, the first line will simply
have the compiler create a string constant and set the ch->titlea pointer to
point to it, the second line will simply point ch->titlea to the same string as
argument (this may cause a problem later, though, if argument is a local
variable and a read attempt on ch->title is attempted from another function).

I'm guessing that you probably meant to give an example like the following...

strcpy(ch->titlea, "with a big nose");

strcpy(ch->titlea, argument);

If ch->titlea has not first been set to point to a properly allocated area of
memory this will almost always cause some type of problem and usually end up
causing a seg. fault.

Regards,

Peter


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST