Results 1 to 6 of 6

Thread: [RESOLVED] How to delete text file!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    88

    Resolved [RESOLVED] How to delete text file!

    I have a sequential file and I would like to edit it. I will do this by reading it all into an array, edit it, and write it all back. When I do that, the new edited text writes perfectly... but it doesn't remove the OLD text!!!!

    How can I remove ALL the text inside the text file and re write it?

    thankyou
    You should LEARN not COPY... by learning you could be original in future work ... by copying you will risk getting in trouble.

    And as always.... What goes around .. Comes Around.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: How to delete text file!

    You seem to be appending instead of overwriting. Check your settings for opening the file in your writing method.
    I don't live here any more.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    88

    Re: How to delete text file!

    hmm I would like to code to delete the ALL the text inside the file and over write it.

    exmaple

    streamwriter.clear()

    or somthing like that
    You should LEARN not COPY... by learning you could be original in future work ... by copying you will risk getting in trouble.

    And as always.... What goes around .. Comes Around.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to delete text file!

    Like wossname suggested:
    VB Code:
    1. Dim sw As New StreamWriter("<file path here>", False)
    The second argument is True to append or False to overwrite.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    88

    Re: How to delete text file!

    OHHHHH so that what TRUE means!! thanks dude!!!!
    You should LEARN not COPY... by learning you could be original in future work ... by copying you will risk getting in trouble.

    And as always.... What goes around .. Comes Around.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] How to delete text file!

    May I recommend never using any function without first fully understanding what the arguments are, mean and do.

Posting Permissions

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



Click Here to Expand Forum to Full Width