Re: Hex Numbers in GtkEntry.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Friends,

>Quoting Tom Froysland <Tom.Froysland@xxxxxxxxxxxxx>
Subject: Hex numbers

How is it possible to make a (text) box to get or show a hexadesimal number?
-- 

The way I do it is to use sscanf & sprintf and get/set the hexadecimal numbers
that we get respectively.

//getting an hexdecimal from the gtk_entry.
const gchar *data;
int hex_value;

data=gtk_entry_get_text(GTK_ENTRY(text_box)); 
sscanf(data,"%X",&hex_value); //Ive not done the error checking part.


//setting an hexdecimal to the gtk_entry.
gchar data=(gchar *)g_malloc(sizeof(gchar)*MAX_SIZE);
int hex_value;

sprintf(data,"%X",&hex_value); //Assume hex_value has been set somehow.
gtk_entry_set_text(GTK_ENTRY(text_box),data); 



$0.02
Cheers
Muthu.








-------------------------------------------------
This mail sent through IMP(http://www.nitt.edu)
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux