#include #include #include int main() { FILE *fin, *fout; char buf[1000]; int i; printf("Hello........\n"); if((fin=fopen("qin.txt","r")) == NULL) { printf("Error from open qin.txt!\n"); exit(1); } if((fout=fopen("qout2.txt","w")) == NULL) { printf("Error from open qout2.txt!\n"); exit(1); } i=1; while (NULL != fgets(buf, sizeof(buf), fin)) { printf("*%d: %s",i++,buf); if( (strstr(buf,"*ask*") != NULL) || (strstr(buf,"*look*") != NULL) || (strstr(buf," read ") != NULL) ) { printf(" **: %s",buf); fputs(buf,fout); } } fclose(fin); fclose(fout); printf("OK!\n"); }