Re: why debug step by step, it s ok



baumann@pan wrote on 03/06/05 :
#include <stdio.h>
#include <string.h>

int main() {
        char *buf="5/90/45";

char buf[]="5/90/45";

        char *token;
        char *lasts;

        printf("tokenizing \"%s\" with strtok():\n", buf);
        if ((token = strtok(buf, "/")) != NULL) {
                printf("token = \"%s\"\n", token);
                while ((token = strtok(NULL, "/")) != NULL) {
                        printf("token = \"%s\"\n", token);
                }
        }
}

strings are not mutable...

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c'est ajouter du malheur au
monde." -- Albert Camus.

.