Sign in to follow this  
Followers 0
Gllopc

Filereadline Nested Within Two Loops

4 posts in this topic

Hello, I have a problem in which the FileReadLine($file) code, within the While loop, does not execute each time through the loop after it's read through an entire file once. I think what's happening is there is either a limitation in how many times a nested While will run within another loop, or I need to set the While condition to a different value.

$file = FileOpen(@TempDir & "\hwids2.txt", 0)

$var = IniReadSection("appnics.ini", "ApprovedNICs")

For $i = 1 To $var[0][0]
    While 1
        $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        If StringInStr($line, $var[$i][1]) Then
            MsgBox(0, "The String", $line)      
        EndIf
    WEnd
Next

FileClose($file)

What I am doing is comparing two files; I want to take the first line from file 1, and see if it appears in any of the lines of file 2. Then move to the second line of file 1, and again see if it appears in any of the lines of file 2, and so on.

Can anyone spot my error?

Thank you!

Share this post


Link to post
Share on other sites



HI,

what about reading both files into an array and then compare array index 1 with the complete array2 and so on.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

That's a good idea. How many lines can an array hold? The file holds 1037 lines altogethor.

HI,

what about reading both files into an array and then compare array index 1 with the complete array2 and so on.

So long,

Mega

Share this post


Link to post
Share on other sites

That's a good idea. How many lines can an array hold? The file holds 1037 lines altogethor.

Hi,

right from the helpfile.

Maximum length of a single script line: 4,095

Maximum string length: 2,147,483,647 characters

Number range (floating point): 1.7E308 to 1.7E+308 with 15-digit precision

Number range (integers): 64-bit signed integer

Hexadecimal numbers: 32-bit signed integer (0x80000000 to 0x7FFFFFFF)

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Maximum depth of recursive function calls: 384 levels

Simultaneous open files: 64

Simultaneous active HotKeys: 64

Maximum number of variables in use at one time: No limit

Maximum number of user defined functions: No limit

Maximum number of GUI windows: 1024

Maximum number of GUI controls per window: 4096

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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