Re: Cast from gchar* to int?



On Tue, 24 Sep 2002 14:28:09 -0700
"William L. Thomson Jr." <support obsidian-studios com> wrote:

gint i;
gchar *num = gtk_editable_get_chars(GTK_EDITABLE(contact_num_entry),0,-1);
i = atoi(num);
g_print("i=%d, num='%s'\n", i, num);
g_free(num)

and check the terminal output, perhaps there is a space before the
character or something like that.

you can actually do match with characters, but not for values > 9

what you can do is 
num[0] = num[0]+1;

that will increse the character at position 0 to the next character in the
ASCII table (man ascii). But it will ignore any character at position 2 or
more, and it cannot count higher then 9.

regards,
        Olivier


Attachment: pgpjy15WAtxfJ.pgp
Description: PGP signature



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