Function Reference

IniReadSection

Reads all key/value pairs from a section in a standard format .ini file.

IniReadSection ( "filename", "section" )

 

Parameters

filename The filename of the .ini file.
section The section name in the .ini file.

 

Return Value

Success: Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value.
Failure: Sets @error on failure:
1 if unable to read the section (The INI file may not exist or the section may not exist)
2 if the section was empty, didn't exist, or no standard format data could be found

 

Remarks

A standard ini file looks like:
[SectionName]
Key=Value


The number of elements returned will be in $result[0][0]. If an @error occurs, no array is created.

 

Related

IniDelete, IniWrite, FileReadLine, IniRead, IniReadSectionNames

 

Example


$var = IniReadSection("C:\Temp\myfile.ini", "section2")
If @error Then
    MsgBox(4096, "", "Error occured, 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