Originally Posted by
elad
I think you probably want sprintf() to use C syntax or C++ stringstreams.
Thanks, you put me on the right track. Here's what I come up with that works:
Code:
void page_forward(Fl_Widget*, void*)
{
test->uncache(); // Clear the image
const char* buffer; // Const buffer
char* temp_buff; //Char Buffer
const char* file_ext = ".gif"; //File Extension
stringstream ss;
Page_Num = Page_Num + 1; // Increase the page count
ss << Page_Num << file_ext; //combine them in the stream
string s = ss.str(); //convert to string
sprintf(temp_buff, ss.str().c_str()); //convert to char array
buffer = temp_buff; //convert to const
test = new Fl_GIF_Image(buffer); //load the image cache
img_butt->image(test); // assign the cache to the button
window->redraw(); // Force a redraw
}
It works well, but uses a little more memory then I like. It's also kind of lengthy. Is there a more efficiant way of doing this?