>> I have a global integer variable in my code (called intFlipCount) that
>> I need to assign to a Fl_Output widget. The following is the Fl_Output control:
>>
>> Fl_Output* outFlipCount = new Fl_Output(400, 550, 50, 25, "Flip count");
>
> You can use sprintf() to get it into a string, then use Fl_Output's
> value() method to apply that string to it. e.g.
>
> char s[40];
> sprintf(s, "%d", intFlipCount);
> outFlipCount->value(s);
>
std::ostringstream OS;
OS << intFlipCount;
outFlipCount->value(OS.str().c_str());
The main difference - this kind of code never will cause a buffer
overflow. This time s[40] for sure is big enough for an integer, but as
far as I know, estimating buffer lengths continues to cause vulnerable
programs.