Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-02-2009, 10:54 AM
Member
 
Join Date: Jun 2009
Posts: 27
Rep Power: 0
sandeepsai17 is on a distinguished road
Default Help needed Clearing the contents of a File
hi to all , i want to clear or erase the contents of a text but not to delete it.
I don't know how to do this ,please help me.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-02-2009, 11:04 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,256
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Delete the existing file and create a new file with the same name.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-02-2009, 11:36 AM
Member
 
Join Date: Jun 2009
Posts: 27
Rep Power: 0
sandeepsai17 is on a distinguished road
Default
thanks,but i did as you said but my program needs to erase contents of a file only in some situations,for example when user click the erase button then only contents of the file should be erased but in all other situations data should remain in text as it is.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-02-2009, 11:52 AM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 533
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
Hi,
Anyway u want to empty the file when u press the button.Just delete and recreate it whenever button is pressed.

-Regards
Ramya
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-02-2009, 11:59 AM
Member
 
Join Date: Jun 2009
Posts: 27
Rep Power: 0
sandeepsai17 is on a distinguished road
Default
ok thanks ,it is working correctly.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-02-2009, 03:31 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,256
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by sandeepsai17 View Post
thanks,but i did as you said but my program needs to erase contents of a file only in some situations,for example when user click the erase button then only contents of the file should be erased but in all other situations data should remain in text as it is.
Before delete the file, read the content and use the data based on your requirements.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read file from directory, update contents of the each file svpriyan New To Java 2 05-11-2009 11:07 AM
MouseListener - clearing a textField when clicked on?! sailor_girl AWT / Swing 4 03-01-2009 06:01 PM
seperation of file contents Ms.Ranjan New To Java 5 07-11-2008 10:17 PM
swapping the contents of the file and writing to another file Ms.Ranjan New To Java 9 07-10-2008 05:52 PM
Viewing contents of JAR file Java Tip Java Tips 0 12-21-2007 04:12 PM


All times are GMT +2. The time now is 05:52 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org