Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!rutgers!mailrus!cornell!rochester!ur-tut!ur-valhalla!badri From: badri@valhalla.ee.rochester.edu (Badri Lokanathan) Newsgroups: comp.unix.questions Subject: Truncating an open file under BSD 4.3 Keywords: Empty, !ftruncate, fcntl? Message-ID: <1392@valhalla.ee.rochester.edu> Date: 26 Jul 88 03:41:44 GMT Organization: UR Dept. of Electrical Engg, Rochester NY 14627 Lines: 13 What is the best way to empty an already open write-only file under BSD 4.3? I have an application where I need large amounts of alphanumeric data dumped to a file which then must be periodically emptied. I also need to be able to scan this data occasionally with a pager. I do not want to close and reopen the file since open is an expensive call (prof claims it to take about 15ms/call on a SUN 3/110.) I tried truncate but it leaves holes in the file, which make it unreadable. I also could not find a way with fcntl, which surprises me. -- "We will fight for the right to be free {) badri@valhalla.ee.rochester.edu We will build our own society //\\ {ames,cmcl2,columbia,cornell, And we will sing, we will sing ///\\\ garp,harvard,ll-xn,rutgers}! We will sing our own song." -UB40 _||_ rochester!ur-valhalla!badri