Re: Hex Numbers in GtkEntry.
- From: Muthiah Annamalai <ec10130 nitt edu>
- To: gtk-list gnome org
- Subject: Re: Hex Numbers in GtkEntry.
- Date: Thu, 26 Feb 2004 08:55:39 +0530
Hello Friends,
>Quoting Tom Froysland <Tom Froysland roma2 infn it>
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]