/* demoras.c: This demo demonstrates how to read/save sun rasterfiles using sunras.c routines. The routines "readsunras" and "savesunras" are interface routines into sunras.c. The are included in this file so that you may use your own error handlers. Created by: Hai Pham and Don Quon */ #include #include #include "sunras.h" void readsunras(char *,long **,int *,int *); void savesunras(char *,long *,int ,int ); int main(void){ long i,j; long *finalimage; long *image; long *image2; int dx,dy; int dx2,dy2; char infilename[60]; char outfilename[60]; printf("enter input filename: "); scanf("%s",infilename); printf("enter output filename: "); scanf("%s",outfilename); /* read in the image */ readsunras(infilename,&image,&dx,&dy); /*allocate memory for new image*/ finalimage=(long *)malloc(dx*dy*sizeof(long)); if (finalimage==NULL){ printf("error allocating memory\n"); return 0; }/* end if*/ /* copy old image into new image */ for (i=0;i