I hava a string, say ../bin/test.c
, so how can i get its substring test
?
I tried strtok
api, but it seems not good.
char a[] = "../bin/a.cc";
char *temp;
if(strstr(a,"/") != NULL){
temp = strtok(a, "/");
while(temp !=NULL){
temp = strtok(NULL, "/");
}
}