Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ ROM ➜ Running the server ➜ BUG: Warning: fread_word encountered EOF

BUG: Warning: fread_word encountered EOF

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kit DeKat   (3 posts)  Bio
Date Sun 15 Jul 2001 02:22 AM (UTC)
Message
I am currently running a Michael K Weis' Win32 port of ROM 2.4b4 which has OLC and color already implemented.
(http://home.att.net/~mkw/mudframe.html -> mkwMUD-src.zip)

This version is completely ported over to C++ (ie: includes .cpp files) and ready to compile out-of-the-box. All you have to do is make the player/god/... folders and define them within the code.

One problem though, once running, i can make a new character, play around and quit just fine. BUT when i go to load that character it gives me the following log and locks up... doesnt even exit cleanly.

write_to_descriptor: MOPP: 2048; Bytes written: 2048; Bytes written 115
Loading Xrythe.
[*****] BUG: Warning: fread_word_char() encountered EOF.
[*****] BUG: Fread_char: no match.

the "Loading ___." and "Fread_char: no match" tell me that the error is within the only call to fread_word() within fread_char() as it reads in the character file. There's no match because there is no case for EOF returned. With my own debugging logic i have followed the trace from:

load_char_obj(fp, name) ->
...
word = fread_word(fp);
if (!str_cmp( word, "PLAYER" )) fread_char (ch, fp);
...

fread_char(ch,fp) ->
...
for ( ; ; )
word = feof(fp) ? "End" : fread_word(fp);
...

fread_word(fp) ->
...
for( ; pword < word +MAX_INPUT_LENGTH; pword++) {
*pword* = getc(fp);
if( feof(fp) || (cEnd == ' ' ? isspace(*pword) : *pword == cEnd)) {
...
if( feof(fp) )
bug( Warning: fread_word() encountered EOF.", 0);
...

cant determine why fread_word() fails on player file and not anywhere else (ie: areas/... ). MKW even added the feof() check in fread_word() not found in original ROM stock, so he knew it was an issue but apparently he got around it.
Top

Posted by Kit DeKat   (3 posts)  Bio
Date Reply #1 on Sun 15 Jul 2001 02:25 AM (UTC)
Message
correction:
-- BUG: Warning: fread_word() encountered EOF.
not:
-- BUG: Warning: fread_word_char() encountered EOF.

constantly mix fread_char() and fread_word() up. :p
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 15 Jul 2001 03:56 AM (UTC)
Message
For a start I would change fread_to_eol to allow for end of file, see changes in bold:



void fread_to_eol( FILE *fp )
{
    char c;

    do
    {
	c = getc( fp );
    }
    while ( c != '\n' && c != '\r' && c != EOF);

    do
    {
	c = getc( fp );
    }
    while ( c == '\n' || c == '\r' );

    ungetc( c, fp );
    return;
}



I'm not sure why, but I made the problem go away by commenting out two lines in fread_char:


// sprintf(buf,"Loading %s.",ch->name);
// log_string(buf);


It seems that somehow the logging is interfering with the file pointer for the read_word, but why, I don't know.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 15 Jul 2001 04:26 AM (UTC)
Message
After more tests I can't work out why it is going wrong, but I suggest you write to Michael K. Weise - after all, it is his code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kit DeKat   (3 posts)  Bio
Date Reply #4 on Sun 15 Jul 2001 05:04 AM (UTC)
Message
Thank you.. it stopped the bug, but odd methods here..
log/eol affects EOF.. ill check into it further myself.
And i was thinking of contacting MKW but there are no recent posts for about a year or so.... *shrug*

thank you. --KDK
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,423 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.