Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!mailrus!ukma!gatech!eedsp!eddins From: eddins@eedsp.gatech.edu (Steve Eddins) Newsgroups: gnu.chess Subject: Bug in SaveGame() Message-ID: <454@eedsp.gatech.edu> Date: 19 Sep 89 17:57:32 GMT Reply-To: eddins@eedsp.gatech.edu (Steve Eddins) Distribution: gnu Organization: Georgia Institute of Technology Lines: 34 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