Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!wrkgrp!ets From: ets@wrkgrp.COM (Edward T Spire) Newsgroups: comp.unix.questions Subject: Re: Truncating an existing file (and lockf question) Message-ID: <1991Apr25.144430.350@wrkgrp.COM> Date: 25 Apr 91 14:44:30 GMT Article-I.D.: wrkgrp.1991Apr25.144430.350 References: <3172@dsacg3.dsac.dla.mil> <16836@chaph.usc.edu> Distribution: usa Organization: The Workstation Group Lines: 22 In article <16836@chaph.usc.edu> jeenglis@alcor.usc.edu (Joe English) writes: >nto0302@dsacg3.dsac.dla.mil (Bob Fisher) writes: >>How can I truncate the end of a large file without copying the part >>to be preserved to a new file and then doing a remove/rename? >> >>This is for SVR3 but may need ported to BSD4.3. > >Check for a system call called 'truncate' or 'ftruncate'. >SunOS has these, but the man pages are (as usual) unclear >as to whether they're from BSD, System V, both, or neither. >I seem to remember seeing this under both BSD4.3 and SVR3. ftruncate() seems to work everywhere we've tried, except SCO/Unix. W/ SCO/Unix, chsize() takes the same parms as ftruncate() and does the same thing... ======================================================================== Ed Spire email: ets@wrkgrp.com (on uunet) The Workstation Group voice: 800-228-0255 6300 River Road, Suite 700 or 708-696-4800 Rosemont, Illinois 60018 fax: 708-696-2277