[Code] User Counter

From: Cris Jacobin (jacobin@NETREACH.NET)
Date: 10/13/97


        I'm having some trouble with the folloing function, and would
appreciate some assistance with it.

        According to my ansi-c primer, the syntax and implementation seem
to be correct, however the user counter never goes above 2.  Anyone see
something obvious, that I've overlooked?

______
void user_cntr(struct descriptor_data *d)
{
FILE *uc_fp;
long u_cnt = 0;

  uc_fp = fopen("USRCNT", "r+b");
  if (uc_fp != NULL)  {
    fread(&u_cnt, sizeof (long), 1, uc_fp);
    u_cnt ++;
    fwrite(&u_cnt, sizeof (long), 1, uc_fp);
    fclose(uc_fp);
    sprintf(buf, "You are player #%ld to logon since 9/10/97", u_cnt);
    SEND_TO_Q(buf, d); }
}
______

-jac
ButterMud - telnet://betterbox.net:4000


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST