At 04:46 PM 3/12/02 -0800, Cameron Barry wrote:
Hey Everyone,First off, I'm new to this stuff for the most part, and may sound like a complete moron, but I'm hoping someone here can help me out. I'm trying to write some code, and I'm getting this error message: act_misc.c:800: request for member `name' in something not a structure or union act_misc.c:805: request for member `name' in something not a structure or union act_misc.c:806: request for member `timer' in something not a structure or union act_misc.c:807: request for member `dir' in something not a structure or union Here's some of the code: { char * buf; char buf2[MAX_STRING_LENGTH]; int track; buf = NULL; for ( track = 0; track < 7; track ++) { buf = ch->in_room->track[track].name; /* <--- Line 800 */ if (buf != NULL) { sprintf(buf2, "Track 1: %s\t\tTimer: %d\tDir %s\n\r", ch->in_room->track[track].name, /* <---- Line 805 */ ch->in_room->track[track].timer, dir_name[ch->in_room-.track[track].dir]); send_to_char(buf2, ch); } etc... In Merc.h: Under room_index_data, I have defined: TRACK_DATA * track[7]; and in the typedef's: typedef struct track_data TRACK_DATA; and in the structs: struct track_data { char * name; int dir; int timer; }; And I just don't understand that error message. Any help would be appreciated. Thanks! -Cameron
You are accessing the member incorrectly. The TRACK_DATA in this example is a pointer to a structure, and not just a structure. So, you need to access it with -> rather than a period.
buf = ch->in_room->track[track].name; /* <--- Line 800 */
Should be:
buf = ch->in_room->track[track]->name; /* <--- Line 800 */
-- Bobby "Chil" Bailey Ye Olde Signatureless Bum

