Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

help with string

$
0
0
Hello people!

I need a little help with text strings input.
I've got something like that:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <windows.h>

int gradii=0, tempoi=0;
Fl_Window *form;
Fl_Input *gradimov, *gradi, *tempo;
Fl_Button *moto;
Fl_Input *gradi, *tempo;
Fl_Box *debug;

void motocb(Fl_Widget*){
char text_to_send[4];
gradii=atoi(gradi->value());
tempoi=atoi(tempo->value());
text_to_send[0]='g';
text_to_send[1]=(char)gradii;
text_to_send[2]='.';
text_to_send[3]=(char)tempoi;
debug->label(text_to_send);

int main(int argc, char *argv[]){
gradi = new Fl_Input(160,65,50,20);
gradi->value("0");
tempo = new Fl_Input(290,65,50,20, "gradi ogni ");
tempo->value("0");
moto = new Fl_Button(350,60,60,30, "Moto");
moto->callback(motocb);
debug = new Fl_Box(20,100,180,30, "OUTPUT");
form->end();
form->show(argc, argv);
return Fl::run();

putting values of 1 and 2 on the "gradi" and "tempo" input boxes i would
like to have "g1.2" string on the label of the debug box; instead i get
something like: "'àNv^A"
which is not right!

How can I have the right string?

Thank you

Mic

Viewing all articles
Browse latest Browse all 6551

Trending Articles