What do you mean? Like you want to make another file of your own to save
your own variables into?

That's easy, look at (if you have this snippet/feature) the ban code. Where
it defines the files path in merc.h then it used a FILE *fp; for the pointer
to the file then you use
if (( fp = fopen( filelocation, "w")) == NULL)
{
    ya I couldn't open the file;
}

Then now that you have the file open you can use functions like fprintf(fp,
"%s", "blah"); to print all of your variables into the file then when your
finished use fclose(fp); to close the file (make sure at the end of the file
you have a \n added.

Then when you read it in you open almost the same but you do "r" rather then
"w" (obviously read/write) and then you can use fread_word, fread_number,
fread_string, and other reading functions.

Look at how pfiles are saved and read back in, that's a good way to write
and read so that the file can nicely be edited by hand if needed. Or for a
more simple but more complicated to work with manually you can look at how
mobs are saved.

You have all the material you need to learn how to do files in your source.
Just need to read through your source and see how the others have done it.
----- Original Message ----- 
From: "Cyhawk" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, November 21, 2003 7:30 PM
Subject: Question file I/O


> Well, i fixed my own problem. *go me* (making a random mob generator, but
> you don't care because you didn't see the problem ;)
>
> Anywho, ive been looking for a guide, or a how to somewhere on how to load
> a file in as varaibles. Basicly i want to load a file with a set number
> of varaibles. Is there a how to somewhere? a guide writen for an idoit
> sorta deal? (Im looking for on-line sources, cant afford any books right
now =(
>
>
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>


Reply via email to