Path: utzoo!attcan!uunet!convex!convex.convex.com!thurlow From: thurlow@convex.com (Robert Thurlow) Newsgroups: comp.lang.c Subject: Re: How do I SHORTEN a file without rewriting it? Keywords: truncation Message-ID: Date: 28 Oct 90 17:27:16 GMT References: <1162@bilver.UUCP> <2830@lectroid.sw.stratus.com> <5289@crash.cts.com> Sender: news@convex.com Lines: 38 In <5289@crash.cts.com> lairdb@crash.cts.com (Laird Broadfield) writes: >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. Take it easy, Laird. ftruncate() is a Berkeley Unix system call, and would probably have nothing to do with K&R or Turbo C in any case. While it isn't all that useful to point to it without saying where it comes from, there very well might have been a lookalike function in someone's C library. And there was no clue to readers of comp.lang.c that Alex wanted an MS-DOS solution. Some people don't think enough about the fact that C is everywhere, and that is not reflective of the way the whole world works. It annoys me wherever I see it. Bruce didn't qualify where he found ftruncate(), but Alex committed an equal crime by not saying he needed a very operating-system-dependent call on MS-DOS, not BSD 4.3. Some people get really confused between language features and standard library routines and system calls, as well. All we can do is try to add to the information, rather than bitch because people are talking about something Turbo C doesn't happen to support. Rob T -- Rob Thurlow, thurlow@convex.com or thurlow%convex.com@uxc.cso.uiuc.edu ---------------------------------------------------------------------- "This opinion was the only one available; I got here kind of late."