I tried using that method, I also tried checking with 'if(strlen(buf) + strlen(mob->player.long_desc) >= MAX_STRING_LENGTH)' and it still Seg Faults... I can't figure out what the heck's wrong with it... How can I keep the buffer from overflowing? How can I clear the buffer when I'm done with it? ×Praetor× **********Orig Message*********** Try inserting the lines into your code I marked below with ---> I have had similar problems when I used the buf and buf1 arrays, especially when putting them in a loop. Since you are not storing it all and paging it to the character this might help. Randell L. Hodges Your code plus my 3 additions noted below.... -------Here's the Code for the command------- ACMD(do_vshow){ struct char_data *mob; struct obj_data *obj; int zone_number; int xvnum; mob_rnum xrnum; char buf[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH]; one_argument(argument, arg); ---> *buf = '\0'; if(!*arg) { sprintf(buf, "You need to specify a zone.\r\n"); send_to_char(buf, ch); } else if(isdigit(*arg) && (atoi(arg) > 0)) { zone_number = atoi(arg); switch(subcmd) { case SCMD_VSHOW_MOB: sprintf(buf, "-----Mobile Information for Zone #%3d-----\r\n", zone_number); send_to_char(buf, ch); for(xvnum = 0; xvnum <= 99; xvnum+=1) { xrnum = real_mobile((zone_number * 100) + xvnum); if(xrnum < 0) { continue; } else { ---> *buf = '\0'; mob = read_mobile(xrnum, REAL); sprintf(buf, "[%d] - %s", (zone_number * 100) + xvnum, mob->player.long_descr); send_to_char(buf, ch); } } break; case SCMD_VSHOW_OBJ: sprintf(buf, "-----Object Information for Zone #%3d-----\r\n", zone_number); send_to_char(buf, ch); for(xvnum = 0; xvnum <= 99; xvnum++) { xrnum = real_object((zone_number * 100) + xvnum); if(xrnum < 0) { continue; } else { ---> *buf = '\0'; obj = read_object(xrnum, REAL); sprintf(buf, "[%d] - %s\n", (zone_number * 100) + xvnum, obj->description); send_to_char(buf, ch); } } break; default: break; } } } +------------------------------------------------------------+ | 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 : 04/10/01 PDT