# include <stdio.h>
/* Program int2asc reads binary file and saves every two bytes
 into ascii file as unsigned integers
 */

void main(int argc, char **argv)
{
	FILE *fpin, *fpout;
	unsigned int k,l,m;
	int c0, c1;

	if (argc != 3) {
		printf("Usage: int2asc  infile outfile\n");
		exit(1);
	}

	if( (fpin = fopen( argv[1], "rb" )) == NULL ) {
		printf("Could not open file %s \n", argv[1] );
		exit(1);
	}
	if( (fpout= fopen( argv[2], "w" )) == NULL ) {
		printf("Could not open file %s \n", argv[1] );
		exit(1);
	}


	while ( ( c0 = getc(fpin) ) != EOF ) {
		c1 = getc(fpin);
		k = c0 + 256*c1;
		fprintf( fpout, "%3u\n", k);
	}

	fclose(fpin);
	fclose(fpout);
}

