Sign in to follow this  
Followers 0
Fossil Rock

FileClose generates error code: -1

4 posts in this topic

Is this normal?

Error code: -1 for line # (343) :       FileClose($Var1)

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites



That doesn't sound like a return value for FileClose() but maybe the error for the wrong File Handle for FileOpen().

$Var1 = FileOpen()

FileClose($Var1) << contains the File Handle for FileOpen... That's the only thing I can think of that would throw a -1 error.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

FileClose() can't be used with filenames -- you must pass it a handle generated by FileOpen().

Here's an example use of FileOpen() and FileClose():

Local $Handle = FileOpen('C:\File.txt')
If $Handle <> -1 Then
   ; Perform file operations
    Local $Data = FileReadLine($Handle)
   ; ···
    FileClose($Handle)
EndIf

Share this post


Link to post
Share on other sites

FileClose() can't be used with filenames -- you must pass it a handle generated by FileOpen().

Here's an example use of FileOpen() and FileClose():

Local $Handle = FileOpen('C:\File.txt')
If $Handle <> -1 Then
  ; Perform file operations
    Local $Data = FileReadLine($Handle)
  ; ···
    FileClose($Handle)
EndIf
Hmmm, that's what I had tried to say, but much more elequently put! :P

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0