R0B45 Posted August 16, 2007 Posted August 16, 2007 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
HawtDogFlvrWtr Posted August 16, 2007 Posted August 16, 2007 Check out "FileReadLine" in the manual. It may be exactly what you want =] CODEa$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)
enaiman Posted August 16, 2007 Posted August 16, 2007 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 :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now