RE: string to guint conversion /w GTK+ 2
- From: German Poo Caaman~o <gpoo ubiobio cl>
- To: gtk-list gnome org
- Subject: RE: string to guint conversion /w GTK+ 2
- Date: 10 Jun 2002 09:00:49 -0400
El lun, 10-06-2002 a las 08:39, David L. Cooper II escribió:
> There isn't an existing function to do this. You'll need to write it, which
> you may have already realized.
>
> Use the strtok function to tokenize the string (i.e. separate the numbers
> from the commas). You call this function iteratively until you get to the
> end of the string. Each time you call the function, it will return a pointer
> to a character string that will contain one of the numbers. You can then use
> a function like atoi (or a glib equivalent if there is one) to convert the
> string to an integer. You can then put this integer intoa GArray.
strtok is unsafe and is unrecommended, use g_strsplit instead.
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gint max_tokens);
--
German Poo Caaman~o
mailto:gpoo ubiobio cl
http://www.ubiobio.cl/~gpoo/chilelindo.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]