... you can try to read from 1 to n ini entries, but test before every read this way you can know how many lines you have in the ini file Another possible solution, add other section with line information [CONTROL] lines=5 [DATA] 1=bla bla 2=bla bla 3=bla ble 4=bla bla 5=bla bla regards Marcelo