0

hi my project involves ping multiple comps simultaneously
to do that i am storing results of each comp in its designated text file
for that at startup i have to clear its contents i want to know how to do that in java???????

4
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by freesoft_2000
0

Two things.
One, show us first what you have. Then we can assist in helping you
Two, this forum is for assistance, not free code. If you want to learn how to do it in Java, show some effort first. I work for a living and do research accordingly. I read the books, search the web for code libraries, etc. It's not that hard if you put forth the effort.

0

hmm, my earlier response seems to have been lost in the depths of the web ;)

Let's try again: the class File (which you use to open and handle disk files as well as in-memory files) has an option to delete a file if it exists and you open it with write access.
If you use that you need to do nothing else.

More details in the API docs.

0

Hi everyone,

You could have a hidden textarea and then read the file into textarea, clear the textarea and then write it back out to the same file thus all the contents are actually cleared. Actually from what i read i think that it is possible for you to use the Java StringBuffer class as you need to clear on startup thus eleminating the use of using any kind of files.

I hope this helps you

Richard West

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.