Jump to content

FileWriteLine not working in my code


Recommended Posts

Hey everyone.

I'm writting a proxy checker in autoit and it works flawlessly, except for FileWriteLine (to output working proxies to a text file)

Here's a snippet of the code

$socket = TCPConnect($ip, $port)
         Sleep(500)
         $fault2 = _WSAGetLastError()
         if @extended Then
             msgbox (262144,"Fault","WSAGetLastError failed")
             $fault2 = 'unknown'
         EndIf
         If $socket = -1 Then
             Switch @error
                 Case 1
                     $fault = "Incorrect IP"
                 Case 2
                     $fault = "Incorrect port"
                 Case Else
                     $fault = "Valid IP and Port"
             EndSwitch
             MsgBox(262144, "Failed to connect","Error = " & $fault2 & @CRLF & $fault)
         Else
             FileWriteLine($outputFile, $currentLine & @CRLF)
         EndIf

Is socket ever != -1

I don't get it. :/

Edited by Roman9
Link to comment
Share on other sites

Thanks for the help oMBRa!

After reviewing the help file further, I realized it was the mode I set with FileOpen :/

Changing

$outputFile = FileOpen("output.txt", 0)

to

$outputFile = FileOpen("output.txt", 1)

fixed everything

Edited by Roman9
Link to comment
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
 Share

  • Recently Browsing   0 members

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