Truncating an open file under BSD 4.3
Badri Lokanathan
badri at valhalla.ee.rochester.edu
Tue Jul 26 13:41:44 AEST 1988
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 at 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
More information about the Comp.unix.questions
mailing list