Charlie,
You didn't post enough information for us to understand your problem.
Whenever you have a problem with code, include at the minimum:
- the error you're getting
- the lines the code is on (perhaps up to the whole function)
- the data types of all variables involved (You forgot this one)
- if it's a crash (doesn't apply to this problem), appropriate gdb output
- if it's a snippet problem, say so, and it wouldn't be a bad idea to
include a link to the snippet
In your post, you should have included the definition of the
data types you're using. In particular, the "name" member of
the social_type structure:
char name[20];
Then we could tell you that the problem is that you can't use
pointer assignment to change an array. You need to use strcpy
or one of its friends.
You should also have said that you were trying to add a snippet,
told what snippet it is (Online social editor by Erwin Andreasen),
and perhaps included a link to it so we could look at the code or
installation directions if we needed to to be able to understand
the problem.
As far as fixing this problem...
The snippet you're using was not written for a ROM mud. Therefore
it might require some porting. There is at least one port of
Erwin's social editor to ROM by Rimbol, but the one I've seen was done
very poorly, and instead of fixing this problem correctly, it just
adds memory leaks, so I can't suggest using it.
The reason you're getting this error is because in the mud the
snippet was written for, the name member of the social_type structure
is a character pointer, not an array as in ROM.
You can *probably* fix the problem by merely changing the name member
from an array to a pointer, but I haven't looked at the code in
detail to make sure, so you should probably check it out first.
Another way you could fix it (less preferable) would be to change
the lines causing the problem to treat the name member as an array
(using strcpy), instead of as a pointer. This would take slightly
more work since you'd have to get rid of the str_dup()'s and make
sure to free the string being returned by fread_string(), and it
doesn't make as efficient use of memory as using a pointer instead
of an array.
Just a note.. Since you didn't post what snippet you're using,
I don't know if this applies to you, but at least one version
of Erwin's social editor snippet has a memory leak when deleting
socials.
Dennis
On Mon, 16 Dec 2002 [EMAIL PROTECTED] wrote:
> I get the same 4 errors on 4 different lines (using msvc to compile)
>
> in void load social
> {
> social->name = fread_string (fp); (this is the first error)
>
>
> in load_social_table
>
> the line
> social_table[maxSocial].name = str_dup(""); /* empty! */
>
> in do_sedit
>
> the line
> social_table[maxSocial-1].name = str_dup (social);
>
> and last but not least
>
> social_table[maxSocial].name = str_dup(""); /*'terminating' empty string*/
>
> all error messages are same
> (error c2106: '=' : left operand must be 1-value
>
> any help is appreciated
> Charlie
> the noobz