GLBasic User Manual

Main sections

INIGET$

value$ = INIGET$(section$, key$ [, nodata$])



Gets the value of "key$" from the section "section$" of an ini file previously opened with the INIOPEN() command.
If either, section$ or key$ do not exist, the return value is "NO_DATA" resp. nodata$.

section$ and key$ are not case sensitive.

See INIOPEN for more information.

Example:
// just to be sure, remove the file
KILLFILE "test.ini"

INIOPEN "test.ini"

color$ = "Colors"
shape$ = "Shapes"

INIPUT color$, "red", 1
INIPUT color$, "green", 2
INIPUT shape$, "Circle", 1
INIPUT shape$, "Poly", "fine"

// write "test.ini" to disk
INIOPEN ""

// Now re-read the file
INIOPEN "test.ini"
PRINT "Red = " + INIGET$(color$, "rEd"), 0, 0
PRINT "Poly = " + INIGET$(shape$, "polY"), 0, 20

PRINT "after removal: ", 0, 50

// remove Color Section
INIPUT color$, "", ""
// remove Poly key
INIPUT shape$, "pOLy", ""

// show again
PRINT "Red = " + INIGET$(color$, "Red"), 0, 70
PRINT "Poly = " + INIGET$(shape$, "PoLy"), 0, 90

SHOWSCREEN
MOUSEWAIT


Output:
Red = 1
Poly = fine

after removal:
Red = NO_DATA
Poly = NO_DATA

See also...