Re: Q: truncate, does it work?

Matthias Urlichs (smurf@noris.de)
28 Feb 1996 21:17:18 +0100


In linux.dev.kernel, article <Pine.LNX.3.91.960227153121.31835A-100000@=
pc5829.hil.siemens.co.at>,
Ingo Molnar <mingo@pc5829.hil.siemens.co.at> writes:
>=20
> 1) Process A is created with standard output redirected to file F
> 2) Process A writes 1000 bytes to the standard output. (to F)
> 3) Process B truncates this file to zero lenght, with "truncate( path=
, 0 )"
> 4) Process A writes to the standard output another 1000 bytes
>=20
> Now the file is 2000 bytes long, and the first 1000 bytes are filled =
up=20
> with zeroes. Is it intended to be this way?
>=20
YES.

> What i'd like to have is to "log" the standard output, and truncate i=
t
> sometimes.
>=20
Open the file with O_APPEND / "a".

--=20
"...skill such as yours is evidence of a misspent youth."
-- Herbert Spencer
--=20
Matthias Urlichs \ XLink-POP N=FCrnberg | EMail: urlichs@smurf.=
noris.de
Schleiermacherstra=DFe 12 \ Unix+Linux+Mac | Phone: ...please use =
email.
90491 N=FCrnberg (Germany) \ Consulting+Networking+Programming+etc'i=
ng 42
PGP: 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE=20
Click <A HREF=3D"http://smurf.noris.de/~smurf/finger">here</A>.