Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!accuvax.nwu.edu!tank!shamash!nic.MR.NET!hal!ncoast!allbery From: allbery@ncoast.ORG (Brandon S. Allbery) Newsgroups: comp.unix.wizards Subject: Re: How can a file be truncated on System V?? Message-ID: <13620@ncoast.ORG> Date: 6 May 89 16:49:54 GMT References: <651@mitisft.Convergent.COM> <887@twwells.uucp> <13619@ncoast.ORG> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 25 As quoted from <13619@ncoast.ORG> by allbery@ncoast.ORG (Brandon S. Allbery): +--------------- | Standard System V (except perhaps 3.2) doesn't have this. Xenix System V | may use one of two methods: +--------------- I forgot to mention that different versions of Xenix use one or the other, never both. The zero-length write trick is pretty much obsolete. +--------------- | (1) zero-length write at point of truncation | (2) a system call whose name I've forgotten which truncates the file at | the current lseek() position +--------------- I remembered it: chsize(fd). It will also "grow" the file if you've lseek()'ed past EOF. (I don't know whether it uses "holes" where possible or always allocates disk space.) ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@ncoast.org uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@ NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser