/* program to convert remapp image to imvis image */
#include "stdio.h"
main()
{
    struct
	{
    int scan;
	int pixel;
	} size;
    char fname[80],c,buffer[3000];
    int i,recl;
    FILE *rptr,*fptr;
    puts("\nREM2DAT - strips the header from a REMAPP image");
    puts("          to form a PDS image data file.");
    puts("\nEnter input REMAPP image file name: ");
	get_f(fname);
    if((rptr = fopen(fname,"rb")) == NULL)
	{
		printf("File not found\n");
		exit(1);
	}                    
    puts("\nEnter output PDS image data file name: ");
	get_f(fname);
    if((fptr=fopen(fname,"wb"))==NULL)
    {
	printf("Can't open output file\n");
	exit(1);
    }
    puts("\nEnter number of pixels: ");
    scanf("%u",&size.pixel);
    puts("\nEnter number of scan lines: ");
    scanf("%u",&size.scan);
    recl=100;
    if(size.pixel > 100) recl=size.pixel;
    fread(buffer,recl,1,rptr);        /* discard header */
    for(i=0;i<size.scan;i++) {
    fread(buffer,recl,1,rptr);
	fwrite(buffer,size.pixel,1,fptr);
    }
    fclose(rptr);
    fclose(fptr);
    printf("You will have to create a .lbl file for this image.\n");
}
int get_f(name)
char name[];
{
	int i, c_count, flag;
	char c;
	flag = 1;
	while(flag)
	{
		gets(name);
		flag = 0;
	}
}
