|
-
May 16th, 2000, 01:16 AM
#1
Thread Starter
Lively Member
If inside my code, I opened a text file using
Open "a.txt" for Input at #1
How do I erase the file if I decided to cancel the operation after this statement and before the Close #1?
-
May 16th, 2000, 01:24 AM
#2
transcendental analytic
No direct ways, you can go to the immediate window and close it there, and then delete the file. Or you can shell dos to unlock your harddrive and then delete it, don't know if that works but windows have locked all opened files.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 16th, 2000, 02:53 AM
#3
You mean, open a txt file and delete everything inside?
Open "C:\[Text file]" For Output Shared As #1 'Read or Write
Print #1, "" 'Write nothing erasing file completely
Close #1 'Close it
Is that what you meant?
[Edited by Matthew Gates on 05-16-2000 at 03:56 PM]
-
May 16th, 2000, 03:51 PM
#4
Thread Starter
Lively Member
Nope... I want to completely delete the file from my harddisk.
-
May 16th, 2000, 04:58 PM
#5
Hyperactive Member
Hello trisLOGIC,
Use this source:
Private Sub Form_Load()
Dim DelText As String
DelText = "c:\q.txt"
Open DelText For Output Shared As #1 'Read or Write
Print #1, "test" 'Write nothing erasing file completely
Close #1 'Close it
If Dir(DelText) <> "" Then Kill (DelText)
End Sub
Good luck,
Michelle.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|