Nothing's wrong with fread, whats wrong is what ever it was trying to read
in. You told it to read a word. But there is no more information in the file
to read. So either you read a string that wasn't ended with a ~ or your
reading too far into the file. You need to look at what is being read, and
make sure that it's being read the same way it's being saved.

So if your doing a number you use fread_number if your doing just a word
that you read just a word. And that all things that you read as fread_string
have a ~ at the end of that string. So it stops the fread_string function
from reading.

----- Original Message -----
From: "Timothy Lindsay" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, March 14, 2003 6:54 PM
Subject: Re: Fread Word


>
> I found that the error has something to do with the
> password. Does this look right?
>
> /*
>  * Read one word (into static buffer).
>  */
> char *fread_word( FILE *fp )
> {
>     static char word[MAX_INPUT_LENGTH];
>     char *pword;
>     char cEnd;
>
>     do
>     {
> cEnd = getc( fp );
>     }
>     while ( isspace( cEnd ) );
>
>     if ( cEnd == '\'' || cEnd == '"' )
>     {
> pword   = word;
>     }
>     else
>     {
> word[0] = cEnd;
> pword   = word+1;
> cEnd    = ' ';
>     }
>
>     for ( ; pword < word + MAX_INPUT_LENGTH; pword++ )
>     {
> *pword = getc( fp );
> if ( feof(fp) || ( cEnd == ' ' ? isspace(*pword) :
> *pword == cEnd ) )
> {
>     if ( cEnd == ' ' )
> ungetc( *pword, fp );
> if( feof(fp) )
> bug( "Warning: fread_word() encountered EOF.", 0 );
>     *pword = '\0';
>     return word;
>
> What does the < sign do in this statement?
> for ( ; pword < word + MAX_INPUT_LENGTH; pword++ )
>
> --- sarix <[EMAIL PROTECTED]> wrote:
> > Your not reading the file properly. EOF is End of
> > File. What you need to do
> > ius go through your saving functions and make sure
> > they look exactly like
> > your loading functions..... Looks like your probly
> > just reading something
> > wrong in..... If all goes wores use GDB to step
> > through the loading and
> > watach it load.
> >
> >
> > ----- Original Message -----
> > From: "Timothy Lindsay" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Friday, March 14, 2003 3:43 PM
> > Subject: Fread Word
> >
> >
> > >
> > > When I am start the mud and try to login I get an
> > > error that says:
> > > Warning: fread_word encountered EOF.
> > >
> > > Fread_char: no match.
> > >
> > > Also my area with the elementals is forming a lot
> > of
> > > errors. Does anyone know how to fix this?
> > >
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Web Hosting - establish your business
> > online
> > > http://webhosting.yahoo.com
> > >
> > > --
> > > ROM mailing list
> > > [email protected]
> > > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> > >
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>


Reply via email to