Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!rutgers!cs.utexas.edu!sdd.hp.com!ucsd!nosc!crash!lairdb From: lairdb@crash.cts.com (Laird Broadfield) Newsgroups: comp.lang.c Subject: Re: How do I SHORTEN a file without rewriting it? Keywords: truncation Message-ID: <5289@crash.cts.com> Date: 27 Oct 90 00:12:09 GMT References: <1162@bilver.UUCP> <2830@lectroid.sw.stratus.com> Organization: "Well, a head on top, an arm on each side, two legs...." Lines: 23 In article <2830@lectroid.sw.stratus.com> bad@atrain.sw.stratus.com (Bruce Dumes) writes: >In article <1162@bilver.UUCP> alex@bilver.UUCP (Alex Matulich) writes: >> >>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. > >Have you thought about using ftruncate()? Okay, tell us where in K&R you find ftruncate. I don't see it in the TurboC manual, or K&R2. Perhaps YOUR funky.lib has it, but not everyone's does. As long as we're on the subject, does anyone have a neat-o method for getting rid of records from the _beginning_ of a file? (Standard preferred, but if there's an MSDOS way, I'll accept it....) -- -- Laird P. Broadfield | Year after year, site after UUCP: {akgua, sdcsvax, nosc}!crash!lairdb | site, and I still can't think INET: lairdb@crash.cts.com | of a funny enough .sig.