home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <io.h>
- #include <fcntl.h>
- #include <sys\stat.h>
- #include <d:\poweru\cache.h>
-
- void main(int parnum,char *pars[])
- {
- int pointnum=0,
- infileh,
- scikv,
- scikh;
- FILE *outfile;
- unsigned char pixel;
-
- if(parnum<2)
- {
- printf("Too few parameters!!\n\n");
- exit(EXIT_FAILURE);
- }
- if((infileh=open(pars[1],O_RDONLY|O_BINARY))==-1)
- {
- printf("Bad filename!!\n\n");
- exit(EXIT_FAILURE);
- }
- if(!(outfile=fopen("datas.db","wb")))
- {
- printf("Output file creation error!!\n\n");
- exit(EXIT_FAILURE);
- }
- fprintf(outfile,"datas");
- readablecache cachein(infileh);
- for(scikv=0;scikv<200;scikv++)
- {
- for(scikh=0;scikh<320;scikh++)
- {
- pixel=cachein.readitem();
- if(pixel==255)
- {
- pointnum++;
- fprintf(outfile,"\tdw\t%i,%i,0\t\t;%i%c%c",scikh-159,0-(scikv-99),pointnum,0x0d,0x0a);
- printf("\tdw\t%i,%i,0\t\t;%i%c%c",scikh-159,0-(scikv-99),pointnum,0x0d,0x0a);
- }
- }
- }
- cachein.~readablecache();
- close(infileh);
- fclose(outfile);
- printf("%i points.\n\n",pointnum);
- exit(EXIT_SUCCESS);
- }
-