Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!ux1.cso.uiuc.edu!tank!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: Truncating a file (was: ... in System V) Keywords: chsize, ftruncate Message-ID: <20692@mimsy.umd.edu> Date: 12 Nov 89 05:02:02 GMT References: <986@dialogic.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 18 In article <986@dialogic.UUCP> drich@dialogic.UUCP (Dan Rich) writes: > int ftruncate(fd,length) > int fd; > off_t length; >ftruncate() causes the file refered to by fd to have a size >equal to length bytes. ... If it was shorter, bytes between the >old and new lengths are read as zeros. Unless it is a BSD system (i.e., not a SunOS system), in which case ftruncate does what its name suggests: *truncates* the file, rather than set its size. In other words, if it was shorter, the file remains shorter. It would have been nice if, while changing the operation, Sun had changed the name as well. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris