/* priklad pr8_9.c tlac suboru po znakoch na tlaciaren */
#include "stdio.h"
void main(void)
{
FILE *fp,*printer;
char fname[25];
char c;
printf("Enter filename: ");
scanf("%s",filename);
fp = fopen(filename,"r");
printer=fopen("$LPT","w");
/* printer=fopen("PRN","w"); pre DOS */
if (fp == NULL) printf("File doesn't exist\n");
else if (printer==NULL)printf("PRN doesn't exist\n");
else
{
do
{
c = fgetc(fp); /* get one character from the file */
if (c != EOF)
{
putchar(c);
putc(c,printer);
}
} while (c != EOF); /* repeat until EOF (end of file) */
}
fclose(fp);
fclose(printer);
}