Jump to content

Recommended Posts

Posted

Im quite new, and I was just wondering the possibility of reading a text file line by line into a single variable.

After each iteration the variable reads the next line in the text file based on a counter. If this is possible, suggestions or the code would be awesome.

Thanks

Posted

Check out "FileReadLine" in the manual. It may be exactly what you want =]

CODE
a$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Line read:", $line)

Wend

FileClose($file)

Posted

FileReadLine seem the obvious choice but you might consider also _FileReadToArray included into File.au3 UDF

That one will read all the content of the file into an array, each array element being a text line.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

  • 5 years later...

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...