I'm trying to parse a document, in which each line has strings separated by tabs (each tab > are 4 blank spaces), but when it comes to making a strtok
I am not being able to recognize those blank spaces.
This is the code snippet in question:
if((toks[0] != '\r') && (toks[0] != '\n') && (toks[0] != 'hola----¿----que----tal----?if((toks[0] != '\r') && (toks[0] != '\n') && (toks[0] != 'hola----¿----que----tal----?%pre%0%pre%0
0')){
while ((toks = strtok(NULL, " ")) != NULL){
if ((strcmp(toks, "\r\n") != 0) && (strcmp(toks, "\r") != 0) && (strcmp(toks, "\n") != 0)){
i++;
inputs = realloc(inputs,i*sizeof(char*));
inputs[i-1] = toks;
numArgs++;
}
}
}
0%pre%0
0')){
while ((toks = strtok(NULL, " ")) != NULL){
if ((strcmp(toks, "\r\n") != 0) && (strcmp(toks, "\r") != 0) && (strcmp(toks, "\n") != 0)){
i++;
inputs = realloc(inputs,i*sizeof(char*));
inputs[i-1] = toks;
numArgs++;
}
}
}
I am not able to do the strtok
of while
to recognize me the 4 spaces, an example of line that should be able to parsear is:
Where each ' -
' represents a character ' '
Thank you very much in advance.