This commit is contained in:
tTh 2023-09-03 07:49:40 +02:00
parent 9d08631b32
commit b404dde88b
1 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,7 @@ for (foo=0; foo<combien; foo++) {
}
puts("");
for (foo=0; foo<combien; foo++) {
printf(" %c ", isprint(ptr[foo]) ? ptr[foo] : '?');
printf(" %c ", isprint(ptr[foo]) ? ptr[foo] : ' ');
}
puts("");
}
@ -27,7 +27,7 @@ puts("");
int main(int argc, char *argv[])
{
char input[] = "foo bar quux quiz";
char input[] = "foo bar\tquux wiz";
char *cptr, *copie;
int foo;
@ -41,10 +41,15 @@ dump_line("1er strtok", copie, sizeof(input));
printf(" got [%s]\n", cptr);
puts("");
puts(" two more strtok...");
cptr = strtok(NULL, " \t");
printf(" got [%s]\n", cptr);
cptr = strtok(NULL, " \t");
printf(" got [%s]\n", cptr);
dump_line("2eme & 3me strtok", copie, sizeof(input));
foo = cptr - copie;
foo = cptr - copie; /* this is the hack :) */
printf(" index = %d\n", foo);
printf(" and we have [%s]\n", input+foo);
return 0;