[-]
PasteIt Eintrag #181
Autor: HAPM
Titel: ReadINISections
Beschreibung: kleine Funktion, die einem alle Sections in einem INI-File als array zurück gibt
 

Code
  1. Function ReadINISections(File)
  2.   Dim data
  3.   Dim fh
  4.   Dim line
  5.   data = ""
  6.   fh = FileOpen(File, FA_Read)
  7.   Do While Not FileEOF(fh)
  8.     line = Trim(FileReadLn(fh))
  9.     If Left(line, 1) = "[" And Right(line,1) = "]" Then
  10.       data = data & Mid(line, 2)
  11.     End If
  12.   Loop
  13.   FileClose fh
  14.   If Len(data) > 0 Then data = Mid(data, 1, Len(data)-1)
  15.   ReadINISections = Split(data, "]")
  16. End Function