Mail Archives: djgpp/1997/09/24/02:01:42
jb AT netcom DOT ca wrote:
<Snipped>
>I was wondering, what C code do you need to write, to make your program
>print what you want it to, during runtime? (besides pushing the Print
>Scrn key)
Use "PRN:" as the filename. Try this:
#include <stdio.h>
#include <errno.h>
main()
{
FILE *prntr;
if ((prntr = fopen("PRN:", "w")) == NULL) {
printf("Error %d! %s: %s\n", errno, "PRN:", strerror(errno));
exit(1);
}
fprintf(prntr, "This appears on the printer,\nthen a page feed\f");
fflush(prntr);
fclose(prntr);
exit(0);
}
----------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org)
- Raw text -