Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file I/O

Status
Not open for further replies.

motel

Technical User
Jul 6, 2001
3
0
0
IN
hi,
i think there is some problem with opening and closing of files thru TCL on MS windows operating system.
my program read as follows

set fp [open c:/temp/xyz.txt w+]
puts $fp "fdf dfdfd fdfdf"
close $fp

Now when i try to delete the c:/temp directory. Windows says that Access Denied, file still in use. I am using TCL which is embedded in a scm product to acess the outside files

regards,
motel
 
Hi motel,

A couple of things. In your message you say you tried to delete c:/temp. Did you mean c:/temp/xyz.txt? The temp directory is used by a lot of Windows apps so deleting it wouldn't be a good idea.

One other possibility that I know I've done a couple of times while testing things in my programs is run a program that creates a file, open the file with a text editor to look at it and then try to delete it while its still open. While it's open in the editor, Windows won't let you delete it and you'll get the error you mention.

Regards,

Ed
 
Oops...forgot to mention, your code is correct. It should close the file properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top