Re: flush() bug?
- Posted by "Juergen Luethje" <j.lue at gmx.de> Sep 22, 2005
- 391 views
Andy Serpa wrote: > Using the following program with exw.exe: > > > ----------------------------- > include file.e > include get.e > > integer fn > > fn = open("test.txt","w") > puts(fn,"Hello") > close(fn) > > ? gets(0) > > ------------------------------------------- > The file "test.txt" is created and the console hangs until you hit > enter. > So far so good. The file test.txt should be "unlocked" (because we > close()'d it) and it is -- I can move it, rename, etc with the console > still open (so the program hasn't terminated.) <snip> > However, if we do this: > > -------------- > fn = open("test.txt","w") > puts(fn,"Hello") > flush(fn) > puts(fn,"Hello") > close(fn) > -------------- > > The file test.txt now stays locked even though it has been closed -- it > won't release until we terminate the program. In other words, if we > use flush() at any point, and then write data to the file after the > flush() and then close(), the file stays locked. On my system (Windows 98) also the last program works as expected. What Windows version do you use? <snip> Regards, Juergen -- Have you read a good program lately?