Xref: utzoo comp.lang.c:33120 comp.os.msdos.programmer:1638 Path: utzoo!attcan!uunet!clyde.concordia.ca!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!crdgw1!ge-dab!tarpit!bilver!alex From: alex@bilver.UUCP (Alex Matulich) Newsgroups: comp.lang.c,comp.os.msdos.programmer Subject: How do I SHORTEN a file without rewriting it? Keywords: truncation Message-ID: <1162@bilver.UUCP> Date: 23 Oct 90 00:25:26 GMT Organization: W. J. Vermillion - Winter Park, FL Lines: 22 I have a very large file which was made by writing a bunch of data structures out to disk. When I wish to delete a structure from this data file, I simply read all the structures following the one to be deleted and write them out one record-length forward, one at a time. I use the fseek(), fread(), and fwrite() functions for this. This process does the job, but it leaves an unused record at the end of the file, and of course the file length remains unchanged. Is there a way to shorten a file, that is, chop some data off the end of it, so that it doesn't consume as much physical space on the disk? The file I have is too big to read into memory and write back out again, and there is not enough room on the disk to write out a temporary file. You can email any help you want, but I'll be looking in this newsgroup for answers also. Thanks... -- _ |__ Alex Matulich (alex@bilver.UUCP) /(+__> Unicorn Research Corp, 4621 N Landmark Dr, Orlando, FL 32817 //| \ UUCP: ...uunet!tarpit!bilver!alex ///__) bitnet: IN%"bilver!alex@uunet.uu.net"