[NEWBIE][CODE] Files

From: Its Me Christian (cd_fl@hotmail.com)
Date: 03/24/01


Ok all... i got a file thing working were it saves something to a file (its
just hack of ACMD(do_file) in the circlemud ftp) but now i want it so it
will make something like GET_CLAN_NAME(ch) == (the text after the line that
says CLANNAME: )

ok if u are wondering wat the hell im on about well here is an example

the file looks something like this:

CNAME: clannamehere
LEADE: leaderofclanhere


now just say i wanted GET_CLAN_NAME(ch) to = the text after CNAME: what
would i do. I will include a snippet underneith and this is the way that i
am reading the file.

-----<<< Snippet >>>-----

  FILE *ACLAN_FILE;
   int num_lines = 0;
   ACLAN_FILE=fopen("../lib/misc/clan", "r");
  get_line(ACLAN_FILE, buf);
  while (!feof(ACLAN_FILE))  {
     num_lines++;
     get_line(ACLAN_FILE,buf);
  }
  fclose(ACLAN_FILE);
  ACLAN_FILE=fopen("../lib/misc/clan", "r");
  buf2[0] = '\0';
  get_line(ACLAN_FILE, buf);
  while (!feof(ACLAN_FILE))
  {
    sprintf(buf2,"%s%s\r\n",buf2, buf);
    get_line(ACLAN_FILE,buf);
   }
   page_string(ch->desc, buf2, 1);
   fclose(ACLAN_FILE);

----<<< End snippet >>>----

if you still dont know what im on about :) then please email me


thankyou for your help

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
   +---------------------------------------------------------------+
   | 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 : 12/04/01 PST