nazgul@apollo.uucp (Kee Hinckley) (01/31/86)
... Well the mail came back address unknown, so... Date: Fri, 31 Jan 86 11:48:30 est From: Kee Hinckley <nazgul> To: medin@.UUCP Subject: Re: Help DOS 3.3 end file Newsgroups: net.micro.apple In-Reply-To: <183@noscvax.UUCP> Organization: Apollo Computer Inc., Chelmsford MA Cc: DOS only keeps very rough track of the length of it's files, but counting the number of 256 character blocks. Thus it really doesn't know how long your file is, but will assume that it runs to nearest 256 byte boundry OR the next NULL byte. When you first write a file each block is nulled, so you don't have to worry about this. However, if you overwrite a file with a shorter file there won't be a null byte at the end. So the solution to all of this is to write a null byte as your last character. Note: There may be a bug in DOS that it won't free up extra blocks if you overwrite with a smaller file. I seem to remember reading this somewhere. This would mean that if you overwrote a 4 block file with a 1 block file it would still think that the other 3 blocks were allocated. This should be easy enough to test. -kee ...decvax!wanginst!apollo!nazgul -- Little Bo-Peep Has lost her sheep, The radar has failed to find them. They'll all, face to face, Meet in parallel space, Preceding their leaders behind them. "A Space Child's Mother Goose"