Results 1 to 6 of 6
  1. #1
    sandeepsai17 is offline Member
    Join Date
    Jun 2009
    Posts
    30
    Rep Power
    0

    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.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    sandeepsai17 is offline Member
    Join Date
    Jun 2009
    Posts
    30
    Rep Power
    0

    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.

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

    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:cool:

  5. #5
    sandeepsai17 is offline Member
    Join Date
    Jun 2009
    Posts
    30
    Rep Power
    0

    Default

    ok thanks ,it is working correctly.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote 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.

Similar Threads

  1. Replies: 2
    Last Post: 05-11-2009, 10:07 AM
  2. MouseListener - clearing a textField when clicked on?!
    By sailor_girl in forum AWT / Swing
    Replies: 4
    Last Post: 03-01-2009, 05:01 PM
  3. seperation of file contents
    By Ms.Ranjan in forum New To Java
    Replies: 5
    Last Post: 07-11-2008, 09:17 PM
  4. Replies: 9
    Last Post: 07-10-2008, 04:52 PM
  5. Viewing contents of JAR file
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 03:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •