Archive: Read ini file (undefined section size)


Read ini file (undefined section size)
Hi everybody !

I would like to read an ini file like this:

[Filelist]
File1=myapp.exe
File2=myconfig.txt
File3= ...
...

(Knowing that the number of files is undefined)

The solution for me would be *read Filelist section* while *something left* and put the read parameters on the stack. The problem is that the ReadIniStr function takes entryname as a parameter, and all i want is to read the next entry in the filelist section each time i call the function.

Any ideas?

Thx in advance !


Can't you just keep reading from File$R0, and increment $R0 until the read value == "" (or Error flag is set)

E.g.

StrCpy $R0 0
LoopRead:
IntOp $R0 $R0 + 1
ClearErrors
ReadINIStr $R1 "$EXEDIR\file.ini" "Filelist" "File$R0"
IfErrors DoneRead

# Do stuff here

Goto LoopRead
DoneRead:


-Stu

Works fine, thx a lot ;)


Originally posted by Lightning20
Works fine, thx a lot ;)
You can also get all entries in a section.

Get all entries in section of INI file

but an enumeration is the better way in this case.