in reply to How to erase the file content

Assuming an Unix operating system...

I was going to say truncate but first i tried a kernel trace which indeed opens and closes the file. That leads me to say that redirecting stdin or /dev/null would do the same.

Only way seems to be rm -f file && touch file. Then again (seen via another kernel trace), touch also opened and closed the file.

Well, i am out of ideas...

Replies are listed 'Best First'.
Re^2: How to erase the file content
by Anonymous Monk on Sep 08, 2005 at 07:05 UTC

    OP has mentioned Win2K. Then why you are assuming unix.

      The OP wanted to truncate a file without opening and closing the file.

      I guess the OP updated the node and deleted the original contents. OP did not mention the OS before parv made the post

        Indeed i did not know the OS before my post. If i had known the OS was not Unix, i would have not replied.