[posting this exchange from email with permission,
as I thought some folks using STL would be curious. -erco]
On 07/07/11 02:38, Casey Rodman wrote:
> I was wondering if you knew any other way to display something
> in a Multiline_Output besides the example posted on your site.
> I have a vector of ints I would like to display in a Multiline_Output.
> I have been trying to create a char* vector that copies my int vector
> with itoa but I don't think that is the correct function to use.
I never use itoa() or atoi() myself; sprintf() and sscanf() have
always seemed more flexible and are standard.
However, since you're using STL, I imagine something like
the following would work, which is more in tune with the 'STL' way
of doing things:
#include <vector>
#include <sstream>
#include <stdio.h>
[..]
std::vector<int> intvec;
intvec.push_back(1);
intvec.push_back(2);
intvec.push_back(3);
[..]
std::stringstream s;
for ( int t=0; t<intvec.size(); t++ ) {
s << intvec[t] << "\n";
}
mo->add(s.str().c_str()); // Fl_Multiline_Output*
More an issue with the use of STL I imagine than anything else.
If you find this useful, I'd like to post the above to
the fltk.general newsgroup so that others can benefit
from the info.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk