Re: [CODE] ^M's in player desc

From: Welcor (welcor@dune.net)
Date: 12/04/01


----- Original Message -----
From: "ironfist" <ironfist@TEXAS.NET>
> from db.c ---->
> if(ch->player.description)
>       fprintf(outfile, "Desc:\n%s~\n", ch->player.description);
>

    if(ch->player.description && *ch->player.description) {
      strcpy(buf, ch->player.description);
      kill_ems(buf);
      fprintf(outfile, "Desc:\n%s~\n", buf);
    }

This is from my version of ASCII pfiles. kill_ems looks like this:

/* remove ^M's from file output */
void kill_ems(char *str)
{
  char *ptr1, *ptr2, *tmp;

  tmp = str;
  ptr1 = str;
  ptr2 = str;

  while(*ptr1) {
    if((*(ptr2++) = *(ptr1++)) == '\r')
      if(*ptr1 == '\r')
        ptr1++;
  }
  *ptr2 = '\0';
}

> ......
>
> case 'D':
>    TAG("Desc") {
>       dest_char->player.description = fread_string(fl, "FAULT loading
> description");

This should work perfectly, once you've taken care of the ^M's.

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/24/03 PDT