I have a piece of code that loops through a char array string to try and detect words. It loops through and if the detects A - Z or a - z or an _ (underscore) it will add it to a char array. What I need, because they're words, is to be able to put them into a string which I can then use another function to check and then can be discarded. This is my function:
char wholeProgramStr2[20000];
char wordToCheck[100] ="";
IdentiferFinder(char *tmp){
//find the identifiers
int count = 0;
int i;
for (i = 0; i < strlen(tmp); ++i){
Ascii = toascii(tmp[i]);
if ((Ascii >= 65 && Ascii <= 90) || (Ascii >= 97 && Ascii <= 122) || (Ascii == 95))
{
wordToCheck[i] = tmp[i];
count++;
printf("%c",wordToCheck[i]);
}
else {
if (count != 0){
printf("\n");
}
count = 0;
}
}
printf("\n");
}
At the moment I can see all of the words because it prints them out on separate lines.
the content of WholeProgram2 is whatever all the lines are of the file. and it is the *tmp argument.
Thank you.