#include ; #include ; #include ; #include ; #include ; #include ; int placenl(char buf[256]){ int i; for (i=0;i<=256+1;i++) { if (buf[i]=='\n' ){ return(i); } } return(257); } void main(void) { FILE *odrformfp; char buf[257],cmd[257],filename[257],keyword[257],keyword2[257]; system("cleanup 20\n"); system("Before files sweeped.\n"); odrformfp=fopen("odrform.txt","w"); printf("******************************\n"); printf("** Order Form for 95/NT **\n"); printf("** Please tune next sample. **\n"); printf("******************************\n"); printf("EZ \n"); printf("filename.txt \n"); printf("keyword \n"); printf("******************************\n"); printf("TR \n"); printf("filename.txt \n"); printf("keyword1 \n"); printf("kewword2 \n"); printf("******************************\n"); printf("** Please write correctly. **\n"); printf("******************************\n"); system("pause"); fprintf(odrformfp,"******************************\n"); fprintf(odrformfp,"**Next Zone Real Active Window\n"); fprintf(odrformfp,"******************************\n"); fprintf(odrformfp,"EZ/TR \n"); fprintf(odrformfp," \n"); fprintf(odrformfp," \n"); fprintf(odrformfp," \n"); fprintf(odrformfp,"******************************\n"); fclose(odrformfp); /*Win95 or NT;*/ system("start odrform.txt"); system("pause"); odrformfp=fopen("odrform.txt","r"); again:; fgets(buf,50,odrformfp); if(buf[0]=='*'){goto again;} strcpy(cmd,buf); cmd[placenl(cmd)]='\0'; fgets(filename,50,odrformfp); filename[placenl(filename)]='\0'; fgets(keyword,50,odrformfp); keyword[placenl(keyword)]='\0'; sprintf(buf,"ref %s %s",filename,keyword); printf("%s\n",buf); system("pause"); system(buf); if((cmd[0]=='E')&&(cmd[1]=='Z')){ sprintf(buf,"ez temp.txt %s",keyword ); printf("%s\n",buf); system("pause"); system(buf); } if((cmd[0]=='T')&&(cmd[1]=='R')){ fgets(keyword2,50,odrformfp); keyword2[placenl(keyword2)]='\0'; sprintf(buf,"tr temp.txt %s %s",keyword,keyword2); printf("%s\n",buf); system("pause"); system(buf); } /* REF filename EZ TEMP.TXT keyword REF filename TR TEMP.TXT keyword keyword2 ;*/ system("del odrform.txt"); printf("Process Finished.\n"); system("del temp.txt"); system("dir *.txt | more"); /*getchar();*/ system("pause\n"); exit(1); /*===================================================;*/ }