Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!lobster!urchin!p6.f506.n106.z1.fidonet.org!Bob.Stout From: Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) Newsgroups: comp.lang.c Subject: Re: How do I SHORTEN a file without rewriting it? Message-ID: <3199.272FC2C5@urchin.fidonet.org> Date: 29 Oct 90 06:03:09 GMT Sender: ufgate@urchin.fidonet.org (newsout1.26) Organization: FidoNet node 1:106/506.6 - Fulcrum's Edge, Spring TX Lines: 13 Since the Unix folks were quick to answer with environment-specific answers to an inherently non-portable question, I can feel free to tell you how to do it under MS-DOS since this is apparently what you were looking for. Use a DOS low-level (file handle) open call to open the file. Then, still using the low-level DOS services, seek to the position where you wish to truncate the file, then perform a DOS write of zero bytes. The same technique can be used to extend a file by seeking to paosition past its present end. Several DOS C compilers already contain non_ANSI functions in their standard libraries to do this - look for chsize(). Hope this helps...