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



German Poo Caaman~o wrote:
El mar, 25-06-2002 a las 09:56, Chris Wareham escribió:

[...]
            } 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 ()


Ahem, this is *old* code (in fact it started life in someone
elses Slashdot headline ticker program). Hence the syntactically
correct (but superfluous) 'sizeof(char)'. Are there any machines
out there with a char that isn't one byte? The PDP-10 perhaps?

Chris

--
chris wareham iosystems co uk (work)
cwareham btinternet com (home)




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