Results 1 to 7 of 7
  1. #1
    trkece is offline Member
    Join Date
    Feb 2011
    Posts
    22
    Rep Power
    0

    Default how to remove contents in a file

    pls tell me how to remove the contents in a text file

    Finally i want to have a empty text file which it consists of nothing in that .


    Thanx
    RK

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    you can just delete and create empty file ).
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    You can just overwrite the file with a blank one!

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by quad64bit View Post
    You can just overwrite the file with a blank one!
    Or you can simply open the file for writing and close it immediately afterwards.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    Or you can simply open the file for writing and close it immediately afterwards.
    I guess thats what I meant :D

  6. #6
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    6

    Default

    JosAH's suggestion seems too efficient.
    Mak
    (Living @ Virtual World)

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by makpandian View Post
    JosAH's suggestion seems too efficient.
    If you want to preserve any previous contents of a file you have to open the file for appending (otherwise the previous contents will be erased).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. remove element contents
    By oliveira in forum XML
    Replies: 5
    Last Post: 12-07-2010, 08:44 AM
  2. Replies: 9
    Last Post: 10-20-2009, 10:52 AM
  3. Replies: 2
    Last Post: 05-11-2009, 10:07 AM
  4. Replies: 9
    Last Post: 07-10-2008, 04:52 PM
  5. Concatenation file contents
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 02-07-2008, 01:29 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
  •