home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
set_prin.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
796b
|
39 lines
/*--------------------------------------*/
/* */
/* SET_PRINTER(X,X) */
/* */
/* Opens output for printing. The */
/* first argument is the file descriptor*/
/* for output. The second is the flag */
/* used in determining where the output */
/* is going to. */
/* */
/*--------------------------------------*/
# include "stdio.h"
set_printer(fd,flag)
int flag;
FILE *fd;
{
char r[8];
int j;
if (!flag){
fd=fopen("LPT1","w");
return(0);
}
j=1;
putstring("p .out",r,8);
r[7]=0;
J00100: if (j>99)
return(-1);
r[1]=(j/10)+48;
r[2]=j-((r[1]-48)*10)+48;
fd=fopen(r,"r");
if (fd!=NULL){
fclose(fd);
j++;
goto J00100;
}
fd=fopen(r,"w");
return(j);
}