Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!princeton!allegra!mit-eddie!rassilon From: rassilon@mit-eddie.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Major bug in all(?) versions of MS-DOS. Message-ID: <4774@mit-eddie.MIT.EDU> Date: Sat, 7-Feb-87 20:15:56 EST Article-I.D.: mit-eddi.4774 Posted: Sat Feb 7 20:15:56 1987 Date-Received: Mon, 9-Feb-87 02:27:56 EST References: <4274@utah-cs.UUCP> Reply-To: rassilon@eddie.MIT.EDU (Brian Preble Organization: MIT, EE/CS Computer Facilities, Cambridge, MA Lines: 33 Keywords: bug In article <4274@utah-cs.UUCP> b-davis@utah-cs.UUCP (Brad Davis) writes: >Here is a probable bug (or feature) in MS-DOS. Does anyone know a >work around (without closing the first file)? Would Gordon Letwin at >Microsoft care to comment? This bug appears on PC-DOS 2.0, PC-DOS 3.0, >and MS-DOS 3.1. (Unix has no problems with this algorigthm.) > >The test goes like this: > Create a file with name 'xxx'. Call this file FD1. > Write 80 bytes to FD1. > Open the file named 'xxx' a second time. Call this file FD2. > Note that NO errors have happened yet. > Try to read 80 bytes from FD2. No bytes are read. > Note that NO error is reported. > If in symdeb push to a new shell. See that the file 'xxx' has > been created but has a size of 0. > Exit the program. See that the file 'xxx' is now 80 bytes long. I don't see any problem with this. Remember, in most computers files are not written too unless the buffer is full (which I don't think 80 bytes fills) or you close the file. From your code it appears that you are trying to read from FD1 before closing it. Yes, the file was created when you originally opened it. This is necessary to ensure that there is room on the disk for at least one block and that you the disk/directory you are attempting to write to actually exists. One way of getting around this without closing the file is to do a 'flush'. This, in essence, means checking to see if the buffer is empty and, if not, writing it's contents to the disk. How to force output in assembly I don't know. In TURBO Pascal I simply use the command FLUSH(filename). -- Rassilon (rassilon@eddie.mit.edu)