FidoNet Echomail Archive
c_echo

<<< Previous Index Next >>>

From: Kurt Kuzba
To: All
Date: 2004-09-20 14:42:28
Subject: [C] numdrop4 notes cont.

From: "Kurt Kuzba" <kkuzba{at}centurytel.net>


    I found a workaround for my QC25 problem.  Since nothing was
 working, I tried just using a string, and it failed.  Weird.  It
 looks like I can't do multiple arguments with sprintf() under
 Win-XP with QC25.  This was the original code:

  if(final > strtol(hs[10], NULL, 10))
  {
    char name[17];
    printf("You made the Numdrop Hall of Fame.\n"
      "%16s[%16s]\rEnter your name [", "", "");
    std_GetStr(name, 17);
    if(NULL == strchr(name, '\n'))
    {
       sprintf(hs[0], "%5d _____ %s\n", final, name);
    }
    else
    {
      sprintf(hs[0], "%5d _____ %s", final, name);
    }
  }

 And this is the workaround, which actually works.

  if(final > strtol(hs[10], NULL, 10))
  {
    char name[17];
    int end;
    printf("You made the Numdrop Hall of Fame.\n"
      "%16s[%16s]\rEnter your name [", "", "");
    std_GetStr(name, 17);
    end = sprintf(*hs, "%5d _____ ", final);
    if(NULL == strchr(name, '\n'))
    {
       sprintf(*hs + end, "%s\n", name);
    }
    else
    {
      sprintf(*hs + end, "%5d _____ %s", name);
    }
  }

    Now, can anybody shed some light on as to how and why this is
 even a problem, or how this fixes it?

Kurt - Wisconsin USA
>  kkuzba{at}centurytel.net   http://home.centurytel.net/kkuzba
>  Failure is an opportunity.  Tao te Ching #79

--- BBBS/LiI v4.01 Flag-5
 * Origin: Prism's_Point (1:261/38.1)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267


<<< Previous Index Next >>>