>
> On 02.07.2011, at 20:07, GM wrote:
>
> >     wi_cli->add(value.c_str());
>
> c_str() returns a temporary variable. Fl_Widget however needs a pointer =
> to a variable that is allocated as long as the browser is around. This =
> would work:
>
> >=20
> >     wi_cli->add(strdup(value.c_str()));
>
>
> but you need to make sure to deallocate the strings when you change =
> entries or delete the browser.
>

Matt, this is from the 1.3 docs.  Are they incorrect?

void Fl_Browser::add    (       const char *    newtext,
                void *          d = 0
        )

Adds a new line to the end of the browser.

The text string newtext may contain format characters; see format_char() for 
details. newtext is copied using the strdup() function, and can be NULL to make 
a blank line.

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

Reply via email to