On Thu, 08 Dec 2011 08:26:54 -0800, Matthias Melcher
<[email protected]> wrote:

>
>On 30.11.2011, at 23:43, Richard Sanders wrote:
>
>> for(loop = 0; loop < entries; ++loop)
>> {
>>   sprintf(name, "%d", loop);
>>    if(!preference->entryExists(name))
>>      exit(2); // should not get to this but loop will have a value of
>> 15 at this point
>
>Well, you are looking for an entry that is named "15", but that is not in your 
>list.

No kidding. You nailed the problem. When I use the value returned by
Fl_Preference::entries(); as the loop condition. 

If comment lines are removed then everything works correctly.
Unfortunately I really need comment lines in the prefs file.

So the problem is that Fl_Preference::entries(); returns the number of
entries plus the number of comments.

I would point out that the code I supplied was to demonstrate the
problem. I was not asking why it did not work, I already know why.

1) Fl_Preference::entries();  is not fit for purpose as stated in the
docs.
2) Fl_Preference::entries(); is working correctly but the docs give
erroneous information.

One I think because if two is true then why bother with the function
in the first place. 

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to