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???????

Recommended Answers

All 3 Replies

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.

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.