XForms: fl_add_browser_line and ostrstream.str()

Michael Ruebner (ruebner@osk3.3web.ne.jp)
Tue, 21 Apr 1998 22:47:41 GMT

# To subscribers of the xforms list from ruebner@osk3.3web.ne.jp (Michael Ruebner) :

I am an absolute beginner with xforms and C++, so please don't
hurt me if I am talking gibberish ...

I need to output some formatted text and came up with the following:

char* Return_Some_Text () {
ostrstream tostring;

tostring.setf(ios::left);
tostring.width(12); tostring << SomeText;
tostring.width(12); tostring << SomeMore;
tostring << "\0";

return tostring.str();
}

int Some_Callback_Function (int number) {
const char *txt = Return_Some_Text();
fl_clear_browser(form->browser);
fl_add_browser_line(form->browser, txt);
delete [] txt;
return 0;
}

Everything displays nicely in the browser window the first time the
function gets called, calling it again will mess up the display by
printing additional characters to the browser. I am out of my wits
here, but it looks like 'txt' never gets cleaned up completely.

I am using libforms.so.0.88 on a i586 linux (2.0.33) box.
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/