Re: [NEWBIE][CODE] Files

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


ok thanx for the help it did get it working more than it did before but
there a few things i can't do and things wrong.

first off. when i do something = strtok() it doesnt work. i have to put it
in sprintf

and seconday. it only reads the first line and returns (null) for the rest
of the lines

when i do that it returns:

clannamehere
(null)
(null)
(null)


and the file looks like:

CLAN: clannamehere
LEAD: clanleader
SPEL: clanspell
CLAN: clannamehere

here is the code that im tring it on:

  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);
     sprintf(buf, "%s", strtok(buf2, ": "));
     sprintf(buf2, "%s\r\n", strtok(NULL, "\n"));
     send_to_char(buf2, ch);
  }

   page_string(ch->desc, buf2, 1);
   fclose(ACLAN_FILE);

** its messy now but i just wanna get it working forst :)


_________________________________________________________________________
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