Re: System.ini Loading/Writing

From: David Cole (tiznor@softhome.net)
Date: 06/12/02


<SNIP>

I see, that was dumb of me.
So this returns no errors, and also opens the file and reads from it:

void LoadSystemIni(void)
{
  struct SystemData *System = NULL;
  FILE *SystemFile;
  int Number = 0;
  char Data[24], Line[MAX_INPUT_LENGTH+1];


  if (!(SystemFile = fopen("System/System.ini", "r"))) {
      mudlog("System Error: Couldn't open system.ini", NRM, LVL_GOD, TRUE);
      return;
  }

  CREATE(System, struct SystemData, 1);

  while (fgetline(SystemFile, Line)) {
    tag_argument(Line, Data);
    Number = atoi(Line);

    if (!strcmp(Data, "LevelForger           : "))
      System->LevelForger = Number
<SNIP>
  }
  fclose(SystemFile);
}

Now that, that is working (and seem to look right?) the only problem I seem
to be having is actually calling the information in a command to view the
data, like below:

ACMD(do_systeminfo)
{
  struct SystemData *System;

  sprintf(BufOne, "LevelForger           : %d\n", System->LevelForger);
  send_to_char(BufOne, ch);
<SNIP>
}

It complains that I am not initilizing *System, my brain is failing me atm,
how am I going to initilize this without = NULL; so that it isn't blank?

Thanks,
Dave

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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