#include "stdio.h";

FILE *fstart();

main(argc, argv)
int argc;
char *argv[];
{
FILE *f;

	f = fstart(argc, argv);
	if (f == NULL) 
		exit();

	printf("%s \n", "Waiting for input");

	downl1(f);

	fclose(f);			/* Close the File	*/

	printf("%s \n", "Finished");
		
}

downl1(f)
FILE *f;
{
unsigned char ch;

	for (;;) {
		if (kbhit()) {
			if (getch() == 27) return;	/* Hit ESC	*/
		}

		ch = bdos(3, 0, 0);	/* Get a character		*/

		if (ch == 26) 		/* ^ Z				*/
			return;

		fputc(ch, f);		/* record it to the file 	*/

		putchar(ch);		/* Display it 			*/
	}
}




/* Figure 16.8: DOWNL1.C, Read a File, DOS version */

