> How would I load an array from a player file (it saves fine)?
> My save:
> for (i = 0; i < 6; i++)
> {
>        if (ch->pcdata->bleed_1[i])
> {
>        fprintf( fp, "Bleed_1 %d\n", ch->pcdata->bleed_1[i]         );
> }
> else
> {
>        fprintf(fp, "Bleed_1 0\n");
> }
> }
>
> My load:
> if (!str_cmp(word,"Bleed_1"))
>            {
>                int i;
>
>                for (i = 0; i < 6; i++)
>                   ch->pcdata->bleed_1[i] = fread_number(fp);
>                fMatch = TRUE;
>                break;
>            }
>

Try this:
to save:
#DEFINE MAX_BLEED 6

fprintf( fp, "Bleed_1 ");
for ( i = 0; i < MAX_BLEED; i++ )
{
    if ( ch->pcdata->bleed_1[i] )
        fprintf( fp, "%d ", ch->pcdata->bleed_1[i] );
    else
        fprintf( fp, "0 ");
}
fprintf( fp, "\n");

And leave your load function alone.  The problem is you are trying to read
in 6 numbers, but do a Carriage Return after you enter in each number.
This will cause fread_number to puke all over itself.

Fraktyl



Reply via email to