Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site mhuxi.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxi!ggl From: ggl@mhuxi.UUCP (LASKARIS) Newsgroups: net.micro.pc Subject: Re: Appending to files. (pc-dos, ms-dos) Message-ID: <382@mhuxi.UUCP> Date: Mon, 16-Dec-85 08:54:56 EST Article-I.D.: mhuxi.382 Posted: Mon Dec 16 08:54:56 1985 Date-Received: Tue, 17-Dec-85 04:27:29 EST References: <900@ecsvax.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 50 Henry Shaffer writes: (condensed) > <>In unix one can redirect output to a file using > or redirect > output to append to an existing file using >> . > E.g., assuming that file "test" has some text in it: > > cat test > test2 > cat test >> test2 > > produces two sequential copies of the test file in the test2 file. > This can be verified by looking at test2, e.g., by cat test2. > So I tried to do the same thing in pc-dos 2.10. He goes on to ask about end-of-file characters (control-Z) in MS-DOS. It is true that the redirection '>>' will append after the EOF character in a DOS file, because MS-DOS (and PC-DOS, as far as I know) uses both the EOF and the byte count (from the directory) to determine the length of a file. Different parts of the operating system disagree as to which to believe. Generally, though, the byte count is usable, and the EOF may be left out of a text file (horrors!) without making trouble for MANY applications. We have one text editor (Edix from Emerging Technologies) which seems to prefer having the EOF character, and another (KEDIT, from Mansfield Software) which seems to rely on the byte count. In the Lattice compiler, for instance, if you use the "level 2" i/o (fopen() et al.) you get an EOF character placed at the end of your file when you fclose() it. However, if you use the "level 1" i/o (open() et al), you get what you put out exactly, i.e., no EOF unless you put it there. In addition, Lattice has a switch that will reverse the fopen() convention so that the EOF character is not put out. (It also changes what Lattice does with newline characters.) The point of all this is that the TYPE command will handle a text file with a correct byte count and NO EOF correctly, and that if you do things this way the '>>' redirection will also work as you expect. You will have to play with your application a bit to make sure that everything else is OK. While I am happy enough with MS-DOS, I find it is full of this kind of silly inconsistency, caught between CP/M and Unix, neither fish nor fowl. For a good laugh, try this: copy \dev\con \dev\prn (text will go to the printer) ^Z David Laurance held captive by LASKARIS, at AT&T International mhuxi!ggl