Jump to content
Sign in to follow this  
NSearch

Read until EOF

Recommended Posts

Hello Everyone, and thank you very much for all of your help so far.

I have a file which containts account number, I would like to loop through the list extracting each one until the end of file. I am just not too familiar with the syntax. Could someone give me an example.

File Example:

129818129737

129781437977

083597324977

927729797297

293729774505

978497247799

13z078249724

7z9247296214

Thanks

Share this post


Link to post
Share on other sites

From the HELP File

$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)

Share this post


Link to post
Share on other sites

You can also read into an array, then you can manipulate it how you need using a For loop.

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("error.log",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    Msgbox(0,'Record:' & $x, $aRecords[$x])
Next

Kerby

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