Keywords searching in the extern English txt
Hello,
can you please advise me some idea, how could I make program, which will find keywords in file.txt (file is in English)? I don't know, which procedure should I choose, what should to do it in the shortest time? What should I do with signs in text and with spaces?
Thank you.
Still I can't find right way how to search keywords in file.txt
Please help me, I can still make it right. made this code:
Code:
#include <stdlib.h>
#include <ctype.h>
int main(void) {
FILE *fr;
char s[30];
fr = fopen("file.txt", "r");
if (!fr) {
fputs("Nemohu otevřít vstupní soubor.\n", stderr);
return 1;
}
while (fgets(s, sizeof(s), fr) != NULL) {
int p;
char array[p];
for (p=0; p<=30;p++) {
while (isalpha(s[p]) && isalpha(s[p++])) {
s[p] = array[p];
}
printf("%c", s[p]);
while (!(s[p] >= 'A' && s[p] <= 'Z')) {
s[p] = s[p+1];
}
printf("%c", s[p]);
}
fputs(s, stdout);
}
fclose(fr);
return 0;
}
, I am thinking about I could make it somehow like:
Code:
do {
if (isalpha(s[p]) {
s[p] = pole[p];
s[p++];
}
else s[p++];
} while (s[p] != EOF);
I need to make it today, please help me someone, I have problems with buffer overflow and I don't know if I am thinking right, I need to see how should right working code is working and I would like to understand it from it.
Thank you.
Greetings, lost Tom.