Traitement-signal-plantes/Code-C/divideChar.c

24 lines
529 B
C
Raw Normal View History

2022-06-03 17:02:49 +02:00
void divideChar(char *res[9] , char *lign , char delimiter){
int i = 0;
int j = 0;
int cptWord = 0;
int lignSize = sizeof(lign);
char *token;
token = (char *) malloc(20 * sizeof(char));
char space = ' ';
while(i < lignSize){
if(lign[i]==delimiter){
token[j+1] = '\0';
res[cptWord] = token;
cptWord++;
}
else if(lign[i] == space) continue;
else{
token[j] = lign[i];
j++;
}
i++;
}
}