Jump to content
Sign in to follow this  
jsteng

question: FileOpen

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...