Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: Set file size in SYSV Message-ID: <10723@smoke.BRL.MIL> Date: 13 Aug 89 00:14:32 GMT References: <708@msa3b.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <708@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >O.K. I give up. How do you set the size of a file in SYSV. >In particular, I want to take a file which is 1000 bytes, and truncate >it to 500 bytes WITHOUT COPYING IT. Not possible in UNIX System V through SVR3.2, probably supported in SVR4.0. You can simulate this operation by snarfing the intended ultimate file contents somewhere safe (like an in-memory array, if it will fit, or a temp file), then use creat() to truncate the file to 0 length, then write back the desired final contents.