#include #include main(int argc, char *argv[]){ FILE *f; char path[50], string[50], S; int i=0, j=0, k=-1, M, l[100], counter=0; if (argc == 1){ printf("\nDwse to onoma tou arxeiou pros anagnwsh : "); scanf("%s", path); } else strcpy(path, argv[1]); f = fopen(path, "r"); if (!f){ /*elegxos arxeiou*/ printf("\n\nSfalma kata to anoigma tou arxeiou %s\n\n", path); return 1; } printf("\nDwse to string pros anazhthsh : "); scanf("%s", string); M = strlen(string); while (!feof(f)){ S = fgetc(f); counter++; j=0; while ((j<=M) && (S==string[j])){ j++; S = fgetc(f); } if (j=M+1){ k++; l[k]=counter; } /* fseek(f, -j*sizeof(char), SEEK_CUR);*/ } printf("\n\nH leksh %s brethike %d fores sto arxeio %s, stis theseis : \n", string, k, path); for(i=0;i