[bb] Simple INI Getter by neos300 [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:40

Previous topic - Next topic

BlitzBot

Title : Simple INI Getter
Author : neos300
Posted : 1+ years ago

Description : Very minimal coding, but it works perfectly.

Code :
Code (blitzbasic) Select
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...