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

From: krenshala (krenshala@jump.net)
Date: 12/04/01


From: Welcor <welcor@DUNE.NET>


> ----- 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

That or don't FTP text files in binary mode from computers running Win* or
DOS.  If you FTP teh files using ASCII mode it will automatically convert
the DOS <crlf> into the UNIX <newline>. (learned this the hard way with
something else.)

     Larry

Larry Robinson
krenshala@jump.net
:wq

--
   +---------------------------------------------------------------+
   | 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