Jump to content

Help with IniReadSection


Recommended Posts

Hey,

I read in the help file about the function IniReadSection(). I can't understand how it's working.

There is written that the element[n][0] obtains the key and the element[n][1] obtains the value.

I realy don't understand it. I tried to obtain them, but it's not working.

Can someone explain it to me with example?

Thanks.

Link to comment
Share on other sites

Make sure with IniReadSection() you use a loop, because $element[n] is the counting variable,

And the example in the helpfile looks fine to me...

$var = IniReadSection("C:\Temp\myfile.ini", "section2")
If @error Then 
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $i = 1 To $var[0][0]  
        MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])
    Next
EndIf

It reads [section2] in the .ini on the first line. then after checking for an error, it starts at 1 and from 1 To $var[0][0] it counts the number of elements returned.

From helpfile: The number of elements returned will be in $result[0][0].

Then in the msgbox() it uses the counting variable $i with either [0] or [1] to show the current key or value.

I hope I was clear enough.

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