On Mon, Sep 25, 2006 at 07:46:38AM +0200, Dov Grobgeld wrote: > In some cases you might find it easier to use either > g_shell_parse_argv () or g_shell_parse_argv () as alternatives to > scanf() when using glib. Numbers may then be extracted through a > simple atof() or atoi(). This usually gives better control and error > handling than scanf(), imo. > > Note though, that if you are using scanf, this means that you are > parsing a syntax. You'd be better off choosing one of the common meta > syntaxes for expressing your data. E.g. XML, JSON, YAML. (Though the > latter appearantly has no c-binding), or "ini" files through the > GKeyFile parser() in glib. If you are using scanf(), you are probaby extractng information from the output of a random program or script or an obscure data format you have little control of. So, if you want to parse it completely, GScanner might simplify it (or at least make your code less ugly), but for extraction prce or POSIX regex functions are more useful. And in simple cases sscanf() is just the right tool -- unless real numbers are present, in that case you lose and have to use g_ascii_strtod() or other methods that do not change their mood with locale. Yeti -- Anonyms eat their boogers. _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list