On Thu, 08 Dec 2011 13:23:12 -0800, Matthias Melcher
<[email protected]> wrote:

[snip]
>I find the documentation precise and correct, but then again, I am not a 
>native English speaker. Maybe you have a better suggestion what the text 
>should be.

To quote the docs (copy/paste)

int     entries ()
        Returns the number of entries (name/value pairs) in a group. 

Make the docs read

Returns the number of entries (name/value pairs, comments and empty
lines) in a group. 

>entries() gives the number of entries in a group. The confusing part may be, 
>that an empty line or a comment line are entries,
>too (or you could not access them). The former has an empty name and an empty 
>value. The latter one has no value, and the
>comment is the name itself, starting with a semicolon.

Yes confusing because the docs make no mention of comments and empty
line to avoid the confusion.

>So entry(int index) correctly returns the entry at a specific index, which 
>could also be a comment.

The docs say

const char *    entry (int index)
        Returns the name of an entry. 

And an empty line has no name as you state above. Perhaps the doc
should say that and in the case of an empty line, what the returned
char * will be. (NULL I suppose)

>And get(const char *name) returns the entry with a specific name (which in 
>your case happen to be numbers). There is no mention that numerical names are 
>counted by entries().

There is no mention that a name can not be numerical, the name is just
a string as is "abc". I do not see your point or why you even mention
it. 

>So here are three solution to your problem:
>
>1: add another entry, name "nValues" or "maxID" to know how many ID's you want 
>to read, or
>
>2: just use get(str, value, "EOD"); . If there is no entry by the name in 
>'str', value will be "EOD", and you will know that there is no entry by that 
>name.
>
>3: loop through all entries, but use only those whose name are numerical.

I had thought of you points 1 - 3 and decided that it is messy and
would not give me what I set out to do. I ended up downloading third
party source code and adding a couple of functions to get exactly what
I want. The source code is in ANSI C so it is very portable.



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

Reply via email to