Truncating an open file under BSD 4.3

Badri Lokanathan badri at valhalla.ee.rochester.edu
Thu Jul 28 03:57:47 AEST 1988


In article <1392 at valhalla.ee.rochester.edu>, I wrote:
> What is the best way to empty an already open write-only file under BSD 4.3?
> ... 
> 3/110.) I tried truncate but it leaves holes in the file, which make
> it unreadable.

Thanks to all who posted the right solution (fflush-ftruncate-lseek)
This was exactly what I had planned to check out; unfortunately I coded my
test program incorrectly (never code just before dinner time :-) causing
strange things to happen.

Hoping sys V has some equivalent form of ftruncate ....
-- 
"Don't blame me for wanting more         {) badri at valhalla.ee.rochester.edu
 The facts are too hard to ignore       //\\ {ames,cmcl2,columbia,cornell,
 I'm scared to death of poverty        ///\\\ garp,harvard,ll-xn,rutgers}!
 I only want what's best for me."-UB40   /\    rochester!ur-valhalla!badri



More information about the Comp.unix.questions mailing list