I am trying to display a sysctl value in an FLTK Fl_Output box.
What is the special sauce I need to display the sysctl value in the Fl_Output box? When I hit return in the box I get the value but returned in the calling command prompt not in GUI.
I tried 'fprint' statement in several spots and I can't figure this out.
Please help me.
I am not sure if I am missing something in the callback. With my previous usage the callback event was initiated by 'button pressing'.
On this learning adventure I just want to see the sysctl value on startup. No polling or redraw needed for now.
I have been through all the examples and I cannot figure it out.
Code:
#include <stdlib.h>
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Output.H>
void box1cb(Fl_Widget *, void *) {
system("sysctl -n dev.cpu.0.temperature");
}
int main(int argc, char ** argv) {
Fl_Window *window = new Fl_Window(400,200, "CPU Temperature");
Fl_Output *box1 = new Fl_Output(180, 90, 70, 30, "CPU0");
box1->callback(box1cb,0);
box1->labelsize(20);
window->end();
window->show(argc,argv);
return Fl::run();
}
What is the special sauce I need to display the sysctl value in the Fl_Output box? When I hit return in the box I get the value but returned in the calling command prompt not in GUI.
I tried 'fprint' statement in several spots and I can't figure this out.
Please help me.
I am not sure if I am missing something in the callback. With my previous usage the callback event was initiated by 'button pressing'.
On this learning adventure I just want to see the sysctl value on startup. No polling or redraw needed for now.
I have been through all the examples and I cannot figure it out.

