Posts

Showing posts with the label windows

Two Things that Drove Me Nuts Today

One: strtok().  See, the thing about strtok() (we're talking c here) is that you can't call this function when it's being used elsewhere. Say you have a function: void DoSomething(void) {       char MyString[] = "Hello all you people";       char seps[] " ";       char *token;       // get the first token in a string:       token = strtok(MyString,seps);       printf("token: %s\n",token);      while (token!=NULL) {            token = strtok(NULL,seps);            printf("token: %s\n",token);       } } All well and good. But, say you're in another module of code and want to use strtok() again,  called from a function within your DoSomething() function: void DoSomething...