> void remove_from_roster(CHAR_DATA *ch)
> {
> char buf[1024];
> FILE *fp;
> char *string;
> char MyArray[1024][1024];
> int i;
string=malloc(sizeof(char)*MSL);
strcpy(string, "End");
//> string = "End";
> sprintf(buf, "%s%s.dat", DATA_DIR,FILENAME);
>
> if ( !( fp = fopen(buf, "w+" ) ) )
> {
> bug( "Could not open data file.", 0 );
> return;
> }
> i = 0;
> for ( ; ; )
> {
> if (feof(fp))
//> string = "End";
strcpy(string, "End");
> else
> fgets(string,MSL,fp);
>
//> if (string == NULL)
if (*string == 0) /* Ok, this is a problem. If string is NULL.. that is, it
points to null.. not if string is empty. :) To determine if string is
empty... string[0] (*string) == '\0').. or *string == 0 since '\0' is 0
char... :) */
> break;
>
> if (!str_cmp(string,"End"))
> break;
>
> strcpy(MyArray[i],string);
> i++;
>
> }
> for (i = 0; MyArray[i] != NULL; i++)
> send_to_char(MyArray[i],ch);
> fclose(fp);
free(string); /* DO NOT FORGET THIS */
> return;
> }
>
> The file it's loading from in ../data/testfile
> and the contents look like this:
>
> testline1
> testline2
> End
>
> If anyone see's what I'm doing wrong please let me know.
>
>
> Think of something witty, and put it -Here-
> Saereth
I usually don't mess with responding to stuff... but I LOVE pointers. :)
Pointers, well, pointers are your friend. If anyone has problems with
pointers, they should email me. I mean, I took a whole CLASS on pointers this
last semester. :) :) :) :) It was fun. We got down so gritty it was just
almost assembly... (Which I'm taking THIS semester :) :) :)) :) Hmmm... HEY,
does anyone know a good website on how threads work? That is, a good tutorial
website? :)
If I made a logic error on this... I'll rewrite the function myself to be
top-of-the-line-speedy-gonzales ... (Not that I mind anyway.)
Sorry. I ramble. Later
Mark
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com