🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steve Eddins Tue, 19 Sep 1989 17:57
Bug in SaveGame()
#45
Author: Steve Eddins
Date: Tue, 19 Sep 1989 17:57
34 lines
1501 bytes
If there's a gnu.chess.bugs newsgroup (mailing list), I couldn't find
it, so I'm posting here.

In gnuchess-1.52 and 1.53, the following lines appear in the
SaveGame() function in uxdsp.c:

>	ShowMessage("File name: ");
>	scanz("%s",fname);

>	if (fname[0] == '\0' || access(fname,W_OK) == -1) 
>		strcpy(fname,"chess.000");  
>	fd = fopen(fname,"w");

Note that if the file you want to save your game in does not already
exist, access(fname,W_OK) returns -1.  Therefore, unless you specify a
pre-existing file in the SaveGame function, all games get written to
chess.000.  I tried the following change, and it worked OK:

>	ShowMessage("File name: ");
>	scanz("%s",fname);
>
>	fd = fopen(fname,"w");
>	if (fd == NULL) 
>	  {
>	    ShowMessage("Cannot open file for writing.");
>	    return;
>	  }

Please mail any responses; I'll summarize if warranted.
-- 
Steve Eddins --- GRA
Georgia Tech, School of Electrical Engineering, Atlanta, GA  30332
uucp:  ...!{allegra,hplabs,ulysses}!gatech!gt-eedsp!eddins
internet: eddins@eedsp.gatech.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads