Bonjours à tous,
Avec le code que voici, j'ai une erreur d'access violation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| const char *param;
char *word;
char* argv[5];
int argc;
int i;
int count;
char *pc = NULL;
param = "-toto";
for(word = strtok(param, " "), i=0;
word != NULL;
word = strtok(NULL, " "), i++)
{
argv[i] = word;
}
argc = i;
for (count = 0; count < argc; count++) {
if (strcmp(argv[count], "-toto") == 0) {
pc = "";
if ((count + 1) < argc) {
if (*argv[count + 1] != '-') {
pc = argv[++count];
}
}
}
} |
à la ligne :
if (*argv[count + 1] != '-')
je ne sais pas comment y remedier
Partager