Code archives/File Utilities/Simple INI Getter

This code has been declared by its author to be Public Domain code.

Download source code

Simple INI Getter by neos3002009
Very minimal coding, but it works perfectly.
Function getinifield(file$, group$, fiield$)
fil = ReadFile(file)
Local p$, ingroup, groupname$,f$,rest$
While Not Eof(fil)
.mix
p = ReadLine(fil)
If Left(p, 2) = "//" Or p = "" Then Goto mix
If Left(p, 1) = "["
ingroup = 1
groupname = Mid(p, 2, Len(p) - 2)
Else
If ingroup = 1
equal = Instr(p, "=")
f = Left(p, equal - 1)
rest = Mid(p, equal + 1)
Else Goto mix
EndIf
EndIf
If groupname = group And fiield = Trim(f) Then Return Trim(rest)
Wend
End Function

Comments

None.

Code Archives Forum