Jump to content

Recommended Posts

Posted (edited)

I have a question with regards to FileOpen.

Given:

  • A text file @MyDocumentsDir & "\book keeper\logs\logs.txt" is used by another app; but I can open and read it.
  • $FileHandle = FileOpen(@MyDocumentsDir & "\book keeper\logs\logs.txt")
  • The code was successfully executed.

something happened afterwards:

logs.txt was renamed and a new logs.txt was created, or simply deleted

a: Will $FileHandle still point to the renamed file? or

b: Will $FileHandle point to the new logs.txt file? or

c: Will $FileHandle point to nothing at all?

 

thks

Edited by jsteng
Posted (edited)

Lastly, according to documents: 
 

Quote

The file handle must be closed with the FileClose() function.

Considering the file was renamed or deleted, SHOULD I still perform FileClose($FileHandle)???

 

Edited by jsteng
Posted
50 minutes ago, jsteng said:

logs.txt was renamed and a new logs.txt was created, or simply deleted

Windows won't allow this as long as there is a program with a open handle to a file... Option C is probably your best bet if you force the operation.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...