#include #include #include //#include //#include const int MinX=5000;//5348 const int MinY=2000;//2265 const int MaxX=10000;//10022-Canada const int MaxY=4600;//4512 int XStarting, XFinish, XStep, YStarting, YFinish, YStep; const char tmpjpgfile[]="tmp.jpg"; const char _tmpjpgfile[]="_tmp.jpg"; void main(int argc, char**argv) { if (argc!=7) { printf("\n Usage:\n"); printf("%s XStarting XFinish XStep YStarting YFinish YStep\n",argv[0]); helping: printf("The XValues could be from %d to %d and YValues could be from %d to %d\n",MinX,MaxX,MinY,MaxY); printf(" Steps could be from 1 to any value !"); exit(1); } XStarting=atoi(argv[1]);//1 XFinish=atoi(argv[2]);//2 XStep=atoi(argv[3]); YStarting=atoi(argv[4]); YFinish=atoi(argv[5]); YStep=atoi(argv[6]); if (XStartingMaxX) goto helping; if (YStartingMaxY) goto helping; if (XFinishMaxX) goto helping; if (YFinishMaxY) goto helping; if (XStep<1 || YStep<1) goto helping; if ((XStarting>=XFinish) || (YStarting>=YFinish)) { printf(" Start values should be smaller than finish !\n"); exit(2); } int XCounter,YCounter; for (XCounter=XStarting;XCounter %s",XCounter,YCounter,FileName);//tmpjpgfile); system(Str); int filesize; FILE *fileptr; if (fileptr=fopen(FileName//tmpjpgfile ,"rb"),fileptr==NULL) { filesize=-1; } else { if (fseek(fileptr,0L,SEEK_END)) { filesize=-1; } else filesize=ftell(fileptr); fclose(fileptr); } /*char Conv[64]; strcpy(Str,"cp "); strcat(Str,tmpjpgfile); strcat(Str," "); itoa(XCounter,Conv,10); strcat(Str,Conv); strcat(Str,"_"); itoa(YCounter,Conv,10); strcat(Str,Conv); strcat(Str,".jpg"); system(Str);*/ if (filesize==8161) { sprintf(Str,"cmp %s %s", FileName//tmpjpgfile ,_tmpjpgfile); // sprintf(Str,"comp %s %s",tmpjpgfile,_tmpjpgfile); if (system(Str)) ; else filesize=1000000; } //unlink(FileName); sprintf(Str,"rm %s",FileName); printf("%d %d %d\n",XCounter,YCounter,filesize); system(Str); //8161 for grey } } }