Re: How do online html docs in GTK+? in /portable/ way possible too?



El mar, 25-06-2002 a las 09:56, Chris Wareham escribió:
> [...]
> gboolean start_browser(const gchar *cmd) {
>      char **args, *ptr, *tokptr;
>      int argc, len, i;
>      pid_t pid;
> [...]
>              } else {
>                  ptr = g_malloc(sizeof(char) * (len + 1));
>                  strcpy(ptr, cmd);
>                  tokptr = strtok(ptr, " ");
>                  args[0] = tokptr;
>                  i = 1;
>                  for(i = 1; tokptr; i++) {
>                      tokptr = strtok(NULL, " ");
>                      args[i] = tokptr;
>                  }
>                  args[i] = tokptr;
> [...]

strtok is not recommended because it modifies the first argument.
Much better g_strsplit ()

-- 
German Poo Caaman~o
mailto:gpoo ubiobio cl
http://www.ubiobio.cl/~gpoo/chilelindo.html
«Hay 10 tipos de personas: las que entienden binario y las que no.»




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