Results 1 to 6 of 6

Thread: Eraseing tex

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344
    how can i clear the text in lets say "\world\com.txt", however keeping the file there.
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Simply open it for output and then close it.

    Code:
    Open "\world\com.txt" For Output As #1
        
    Close #1
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Weird

    That doesn't seem logical to me, i mean if your just opening a file and then closing it...how did it erase? Thanks though it worked.
    -RaY
    VB .Net 2010 (Ultimate)

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Why not you just delete it and reCreate a new one? I think much more faster.

    Code:
    Kill "\world\com.txt"
    Open "\world\com.txt" For Output As #1
    Close #1

  5. #5
    Guest
    chris, nope, that would be just another operation to perform, exactly the reverse of 'faster'.

    Iain is right, because he is opening the file using the OUTPUT keyword, therefore anything between the open and close statements replaces what is already in the file, if there is nothing between the statements, then the file is replaced by a zero-length string. geddit?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    ahhhh

    Thanks a lot for the explanation, i have a better understanding of the open/close command now. I appreciate it, thanks guys!
    -RaY
    VB .Net 2010 (Ultimate)

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